Search in sources :

Example 26 with WebServiceException

use of javax.xml.ws.WebServiceException in project OpenOLAT by OpenOLAT.

the class ViteroManager method changeGroupRole.

public ViteroStatus changeGroupRole(int groupId, int vmsUserId, int roleId) throws VmsNotAvailableException {
    try {
        Group groupWs = getGroupWebService();
        ChangeGroupRoleRequest roleRequest = new ChangeGroupRoleRequest();
        roleRequest.setGroupid(groupId);
        roleRequest.setUserid(vmsUserId);
        roleRequest.setRole(roleId);
        groupWs.changeGroupRole(roleRequest);
        return new ViteroStatus();
    } catch (SOAPFaultException f) {
        ErrorCode code = handleAxisFault(f);
        switch(code) {
            case userDoesntExist:
                log.error("The user doesn ́t exist!", f);
                break;
            case groupDoesntExist:
                log.error("The group doesn ́t exist", f);
                break;
            default:
                logAxisError("Cannot add an user to a group", f);
        }
        return new ViteroStatus(code);
    } catch (WebServiceException e) {
        if (e.getCause() instanceof ConnectException) {
            throw new VmsNotAvailableException();
        }
        log.error("Cannot add an user to a group", e);
        return new ViteroStatus(ErrorCode.unkown);
    }
}
Also used : Group(de.vitero.schema.group.Group) ViteroGroup(org.olat.modules.vitero.model.ViteroGroup) BusinessGroup(org.olat.group.BusinessGroup) WebServiceException(javax.xml.ws.WebServiceException) SOAPFaultException(javax.xml.ws.soap.SOAPFaultException) ErrorCode(org.olat.modules.vitero.model.ErrorCode) ChangeGroupRoleRequest(de.vitero.schema.group.ChangeGroupRoleRequest) ViteroStatus(org.olat.modules.vitero.model.ViteroStatus) ConnectException(java.net.ConnectException)

Example 27 with WebServiceException

use of javax.xml.ws.WebServiceException in project OpenOLAT by OpenOLAT.

the class ViteroManager method getBookingByDate.

public List<ViteroBooking> getBookingByDate(Date start, Date end) throws VmsNotAvailableException {
    try {
        Booking bookingWs = getBookingWebService();
        GetBookingListByDateRequest dateRequest = new GetBookingListByDateRequest();
        dateRequest.setStart(format(start));
        dateRequest.setEnd(format(end));
        dateRequest.setTimezone(viteroModule.getTimeZoneId());
        dateRequest.setCustomerid(viteroModule.getCustomerId());
        Bookinglist bookingList = bookingWs.getBookingListByDate(dateRequest);
        List<Booking_Type> bookings = bookingList.getBooking();
        return convert(bookings);
    } catch (SOAPFaultException f) {
        ErrorCode code = handleAxisFault(f);
        switch(code) {
            default:
                logAxisError("Cannot get the list of bookings by date.", f);
        }
        return Collections.emptyList();
    } catch (WebServiceException e) {
        if (e.getCause() instanceof ConnectException) {
            throw new VmsNotAvailableException();
        }
        return Collections.emptyList();
    }
}
Also used : WebServiceException(javax.xml.ws.WebServiceException) GetBookingListByDateRequest(de.vitero.schema.booking.GetBookingListByDateRequest) Booking_Type(de.vitero.schema.booking.Booking_Type) Booking(de.vitero.schema.booking.Booking) ViteroBooking(org.olat.modules.vitero.model.ViteroBooking) SOAPFaultException(javax.xml.ws.soap.SOAPFaultException) ErrorCode(org.olat.modules.vitero.model.ErrorCode) Bookinglist(de.vitero.schema.booking.Bookinglist) ConnectException(java.net.ConnectException)

Example 28 with WebServiceException

use of javax.xml.ws.WebServiceException in project webcert by sklintyg.

the class ArendeConverterTest method testDecorateArendeFromUtkastHsaNotResponding.

@Test
public void testDecorateArendeFromUtkastHsaNotResponding() {
    Utkast utkast = new Utkast();
    utkast.setIntygsTyp("intygstyp");
    utkast.setEnhetsId("enhetsid");
    utkast.setSignatur(mock(Signatur.class));
    when(utkast.getSignatur().getSigneradAv()).thenReturn("signeratav");
    when(hsaEmployeeService.getEmployee(anyString(), eq(null))).thenThrow(new WebServiceException());
    try {
        ArendeConverter.decorateArendeFromUtkast(new Arende(), utkast, LocalDateTime.now(), hsaEmployeeService);
        fail("Should throw");
    } catch (WebCertServiceException e) {
        assertEquals(WebCertServiceErrorCodeEnum.EXTERNAL_SYSTEM_PROBLEM, e.getErrorCode());
    }
}
Also used : Signatur(se.inera.intyg.webcert.persistence.utkast.model.Signatur) WebServiceException(javax.xml.ws.WebServiceException) Utkast(se.inera.intyg.webcert.persistence.utkast.model.Utkast) Arende(se.inera.intyg.webcert.persistence.arende.model.Arende) WebCertServiceException(se.inera.intyg.webcert.common.service.exception.WebCertServiceException) Test(org.junit.Test)

Example 29 with WebServiceException

use of javax.xml.ws.WebServiceException in project webcert by sklintyg.

the class NotificationWSClientTest method testSendStatusUpdateClientThrowsException.

@Test(expected = TemporaryException.class)
public void testSendStatusUpdateClientThrowsException() throws Exception {
    when(statusUpdateForCareClient.certificateStatusUpdateForCare(anyString(), any(CertificateStatusUpdateForCareType.class))).thenThrow(new WebServiceException());
    notificationWsClient.sendStatusUpdate(createRequest(), LOGICAL_ADDRESS);
}
Also used : WebServiceException(javax.xml.ws.WebServiceException) Test(org.junit.Test)

Example 30 with WebServiceException

use of javax.xml.ws.WebServiceException in project webcert by sklintyg.

the class CertificateSendProcessorTest method testSendCertificateThrowsPermanentOnWebServiceException.

@Test(expected = TemporaryException.class)
public void testSendCertificateThrowsPermanentOnWebServiceException() throws Exception {
    // Given
    when(sendServiceClient.sendCertificate(INTYGS_ID1, PERSON_ID1, SKICKAT_AV, RECIPIENT1, LOGICAL_ADDRESS1)).thenThrow(new WebServiceException());
    // When
    certificateSendProcessor.process(SKICKAT_AV, INTYGS_ID1, PERSON_ID1, RECIPIENT1, LOGICAL_ADDRESS1);
    // Then
    verify(sendServiceClient).sendCertificate(INTYGS_ID1, PERSON_ID1, SKICKAT_AV, RECIPIENT1, LOGICAL_ADDRESS1);
}
Also used : WebServiceException(javax.xml.ws.WebServiceException) Test(org.junit.Test)

Aggregations

WebServiceException (javax.xml.ws.WebServiceException)378 Test (org.junit.Test)115 SOAPException (javax.xml.soap.SOAPException)59 SOAPFaultException (javax.xml.ws.soap.SOAPFaultException)59 SOAPMessage (javax.xml.soap.SOAPMessage)57 ConnectException (java.net.ConnectException)48 ErrorCode (org.olat.modules.vitero.model.ErrorCode)48 URL (java.net.URL)46 SOAPElement (javax.xml.soap.SOAPElement)46 IOException (java.io.IOException)43 SOAPBody (javax.xml.soap.SOAPBody)34 ArrayList (java.util.ArrayList)32 SOAPBodyElement (javax.xml.soap.SOAPBodyElement)32 BindingProvider (javax.xml.ws.BindingProvider)31 Retry (io.github.resilience4j.retry.Retry)29 Service (javax.xml.ws.Service)29 QName (javax.xml.namespace.QName)27 SOAPMessageContext (javax.xml.ws.handler.soap.SOAPMessageContext)21 DataHandler (javax.activation.DataHandler)17 RetryConfig (io.github.resilience4j.retry.RetryConfig)16