Search in sources :

Example 1 with Envelope

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

the class CsdController method careServicesRequest.

// -------------------------------------------------------------------------
// POST
// -------------------------------------------------------------------------
@RequestMapping(value = "", method = RequestMethod.POST, consumes = MediaType.ALL_VALUE, produces = MediaType.ALL_VALUE)
public void careServicesRequest(HttpServletRequest request, HttpServletResponse response) throws IOException, JAXBException {
    Object o = unmarshaller.unmarshal(new BufferedInputStream(request.getInputStream()));
    Envelope env = (Envelope) o;
    validateRequest(env);
    List<OrganisationUnit> organisationUnits = getOrganisationUnits(env);
    Csd csd = createCsd(organisationUnits);
    Envelope envelope = createResponse(csd, env.getHeader().getMessageID().getValue());
    response.setContentType(SOAP_CONTENT_TYPE);
    marshaller.marshal(envelope, response.getOutputStream());
}
Also used : OrganisationUnit(org.hisp.dhis.organisationunit.OrganisationUnit) BufferedInputStream(java.io.BufferedInputStream) Csd(org.hisp.dhis.web.ohie.csd.domain.Csd) Envelope(org.hisp.dhis.web.ohie.common.domain.soap.Envelope) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 2 with Envelope

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

the class CsdController method createResponse.

public Envelope createResponse(Csd csd, String messageID) {
    Envelope envelope = new Envelope();
    envelope.getHeader().getAction().setValue("urn:ihe:iti:csd:2013:GetDirectoryModificationsResponse");
    envelope.getHeader().setRelatesTo(new RelatesTo(messageID));
    GetModificationsResponse response = new GetModificationsResponse(csd);
    envelope.getBody().setGetModificationsResponse(response);
    return envelope;
}
Also used : GetModificationsResponse(org.hisp.dhis.web.ohie.csd.domain.GetModificationsResponse) Envelope(org.hisp.dhis.web.ohie.common.domain.soap.Envelope) RelatesTo(org.hisp.dhis.web.ohie.common.domain.wsa.RelatesTo)

Example 3 with Envelope

use of org.hisp.dhis.web.ohie.common.domain.soap.Envelope 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)3 BufferedInputStream (java.io.BufferedInputStream)1 OrganisationUnit (org.hisp.dhis.organisationunit.OrganisationUnit)1 Fault (org.hisp.dhis.web.ohie.common.domain.soap.Fault)1 RelatesTo (org.hisp.dhis.web.ohie.common.domain.wsa.RelatesTo)1 Csd (org.hisp.dhis.web.ohie.csd.domain.Csd)1 GetModificationsResponse (org.hisp.dhis.web.ohie.csd.domain.GetModificationsResponse)1 ExceptionHandler (org.springframework.web.bind.annotation.ExceptionHandler)1 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)1