Search in sources :

Example 1 with Fault

use of org.hisp.dhis.web.ohie.common.domain.soap.Fault in project dhis2-core by dhis2.

the class CsdController method soapError.

@ExceptionHandler
public void soapError(SoapException ex, HttpServletResponse response) throws JAXBException, IOException {
    Envelope envelope = new Envelope();
    envelope.setHeader(null);
    envelope.getBody().setFault(new Fault());
    envelope.getBody().getFault().getCode().getValue().setValue(ex.getFaultCode());
    envelope.getBody().getFault().getReason().getText().setValue(ex.getMessage());
    response.setContentType(SOAP_CONTENT_TYPE);
    marshaller.marshal(envelope, response.getOutputStream());
}
Also used : Fault(org.hisp.dhis.web.ohie.common.domain.soap.Fault) Envelope(org.hisp.dhis.web.ohie.common.domain.soap.Envelope) ExceptionHandler(org.springframework.web.bind.annotation.ExceptionHandler)

Aggregations

Envelope (org.hisp.dhis.web.ohie.common.domain.soap.Envelope)1 Fault (org.hisp.dhis.web.ohie.common.domain.soap.Fault)1 ExceptionHandler (org.springframework.web.bind.annotation.ExceptionHandler)1