use of se.riv.clinicalprocess.healthcond.certificate.sendMessageToRecipient.v2.SendMessageToRecipientResponseType in project webcert by sklintyg.
the class SendMessageToRecipientProcessor method process.
public void process(@Body String xmlBody, @Header(Constants.INTYGS_ID) String intygsId, @Header(Constants.LOGICAL_ADDRESS) String logicalAddress) throws TemporaryException, PermanentException {
try {
SendMessageToRecipientType parameters = SendMessageToRecipientTypeConverter.fromXml(xmlBody);
SendMessageToRecipientResponseType response = sendMessageToRecipientResponder.sendMessageToRecipient(logicalAddress, parameters);
ResultType result = response.getResult();
switch(result.getResultCode()) {
case OK:
case INFO:
return;
case ERROR:
switch(result.getErrorId()) {
case REVOKED:
case VALIDATION_ERROR:
LOG.error("Call to sendMessageToRecipient for intyg {} caused an error: {}, ErrorId: {}." + " Rethrowing as PermanentException", intygsId, result.getResultText(), result.getErrorId());
throw new PermanentException(result.getResultText());
case APPLICATION_ERROR:
case TECHNICAL_ERROR:
LOG.error("Call to sendMessageToRecipient for intyg {} caused an error: {}, ErrorId: {}." + " Rethrowing as TemporaryException", intygsId, result.getResultText(), result.getErrorId());
throw new TemporaryException(result.getResultText());
}
}
} catch (JAXBException e) {
LOG.error("Call to sendMessageToRecipient for intyg {} caused an error: {}. Rethrowing as PermanentException", intygsId, e.getMessage());
throw new PermanentException(e.getMessage());
} catch (WebServiceException e) {
LOG.error("Call to sendMessageToRecipient for intyg {} caused an error: {}. Will retry", intygsId, e.getMessage());
throw new TemporaryException(e.getMessage());
}
}
use of se.riv.clinicalprocess.healthcond.certificate.sendMessageToRecipient.v2.SendMessageToRecipientResponseType in project webcert by sklintyg.
the class SendMessageToRecipientProcessorTest method buildResponse.
private SendMessageToRecipientResponseType buildResponse(ResultType result) {
SendMessageToRecipientResponseType response = new SendMessageToRecipientResponseType();
response.setResult(result);
return response;
}
Aggregations