Search in sources :

Example 6 with AttributedURIType

use of org.w3.wsaddressing10.AttributedURIType in project webcert by sklintyg.

the class SendQuestionStubTest method answerWithMessageErrorGeneratesError.

@Test
public void answerWithMessageErrorGeneratesError() {
    AttributedURIType address = new AttributedURIType();
    address.setValue(SEND_QUESTION_STUB_ADDRESS);
    SendMedicalCertificateQuestionType parameters = createQuestion("Error");
    SendMedicalCertificateQuestionResponseType answer = stub.sendMedicalCertificateQuestion(address, parameters);
    assertEquals(ResultCodeEnum.ERROR, answer.getResult().getResultCode());
}
Also used : AttributedURIType(org.w3.wsaddressing10.AttributedURIType) Test(org.junit.Test)

Example 7 with AttributedURIType

use of org.w3.wsaddressing10.AttributedURIType in project webcert by sklintyg.

the class SendAnswerStubTest method answerWithMessageErrorGeneratesError.

@Test
public void answerWithMessageErrorGeneratesError() {
    AttributedURIType address = new AttributedURIType();
    address.setValue(SEND_ANSWER_STUB_ADDRESS);
    SendMedicalCertificateAnswerType parameters = createAnswer("Error");
    SendMedicalCertificateAnswerResponseType answer = stub.sendMedicalCertificateAnswer(address, parameters);
    assertEquals(ResultCodeEnum.ERROR, answer.getResult().getResultCode());
}
Also used : AttributedURIType(org.w3.wsaddressing10.AttributedURIType) Test(org.junit.Test)

Example 8 with AttributedURIType

use of org.w3.wsaddressing10.AttributedURIType in project webcert by sklintyg.

the class FragaSvarServiceImpl method sendFragaSvarToExternalParty.

private void sendFragaSvarToExternalParty(final FragaSvar fragaSvar) {
    // Send to external party (FK)
    SendMedicalCertificateAnswerType sendType = new SendMedicalCertificateAnswerType();
    AnswerToFkType answer = FKAnswerConverter.convert(fragaSvar);
    sendType.setAnswer(answer);
    // Remove ASAP.
    if ("true".equalsIgnoreCase(forceFullstandigtNamn)) {
        answer.getLakarutlatande().getPatient().setFullstandigtNamn("---");
    }
    AttributedURIType logicalAddress = new AttributedURIType();
    logicalAddress.setValue(sendAnswerToFkLogicalAddress);
    SendMedicalCertificateAnswerResponseType response;
    try {
        response = sendAnswerToFKClient.sendMedicalCertificateAnswer(logicalAddress, sendType);
    } catch (SOAPFaultException e) {
        LOGGER.error("Failed to send answer to FK, error was: " + e.getMessage());
        throw new WebCertServiceException(WebCertServiceErrorCodeEnum.EXTERNAL_SYSTEM_PROBLEM, e.getMessage());
    }
    if (!response.getResult().getResultCode().equals(ResultCodeEnum.OK)) {
        LOGGER.error("Failed to send answer to FK, result was " + response.getResult().getErrorText());
        throw new WebCertServiceException(WebCertServiceErrorCodeEnum.EXTERNAL_SYSTEM_PROBLEM, response.getResult().getErrorText());
    }
    monitoringService.logAnswerSent(fragaSvar.getExternReferens(), fragaSvar.getInternReferens(), (fragaSvar.getIntygsReferens() == null) ? null : fragaSvar.getIntygsReferens().getIntygsId(), fragaSvar.getVardAktorHsaId(), fragaSvar.getAmne());
    // Notify stakeholders
    sendNotification(fragaSvar, NotificationEvent.NEW_ANSWER_FROM_CARE);
}
Also used : SendMedicalCertificateAnswerResponseType(se.inera.ifv.insuranceprocess.healthreporting.sendmedicalcertificateanswerresponder.v1.SendMedicalCertificateAnswerResponseType) AttributedURIType(org.w3.wsaddressing10.AttributedURIType) AnswerToFkType(se.inera.ifv.insuranceprocess.healthreporting.sendmedicalcertificateanswerresponder.v1.AnswerToFkType) SendMedicalCertificateAnswerType(se.inera.ifv.insuranceprocess.healthreporting.sendmedicalcertificateanswerresponder.v1.SendMedicalCertificateAnswerType) SOAPFaultException(javax.xml.ws.soap.SOAPFaultException) WebCertServiceException(se.inera.intyg.webcert.common.service.exception.WebCertServiceException)

Aggregations

AttributedURIType (org.w3.wsaddressing10.AttributedURIType)8 Test (org.junit.Test)6 SOAPFaultException (javax.xml.ws.soap.SOAPFaultException)2 WebCertServiceException (se.inera.intyg.webcert.common.service.exception.WebCertServiceException)2 LocalDateTime (java.time.LocalDateTime)1 AnswerToFkType (se.inera.ifv.insuranceprocess.healthreporting.sendmedicalcertificateanswerresponder.v1.AnswerToFkType)1 SendMedicalCertificateAnswerResponseType (se.inera.ifv.insuranceprocess.healthreporting.sendmedicalcertificateanswerresponder.v1.SendMedicalCertificateAnswerResponseType)1 SendMedicalCertificateAnswerType (se.inera.ifv.insuranceprocess.healthreporting.sendmedicalcertificateanswerresponder.v1.SendMedicalCertificateAnswerType)1 QuestionToFkType (se.inera.ifv.insuranceprocess.healthreporting.sendmedicalcertificatequestionresponder.v1.QuestionToFkType)1 SendMedicalCertificateQuestionResponseType (se.inera.ifv.insuranceprocess.healthreporting.sendmedicalcertificatequestionresponder.v1.SendMedicalCertificateQuestionResponseType)1 SendMedicalCertificateQuestionType (se.inera.ifv.insuranceprocess.healthreporting.sendmedicalcertificatequestionresponder.v1.SendMedicalCertificateQuestionType)1 HoSPersonal (se.inera.intyg.common.support.model.common.internal.HoSPersonal)1 FragaSvar (se.inera.intyg.webcert.persistence.fragasvar.model.FragaSvar)1 IntygsReferens (se.inera.intyg.webcert.persistence.fragasvar.model.IntygsReferens)1 Vardperson (se.inera.intyg.webcert.persistence.fragasvar.model.Vardperson)1 IntygContentHolder (se.inera.intyg.webcert.web.service.intyg.dto.IntygContentHolder)1 WebCertUser (se.inera.intyg.webcert.web.service.user.dto.WebCertUser)1