Search in sources :

Example 1 with FaultDocument

use of org.xmlsoap.schemas.soap.envelope.FaultDocument in project arctic-sea by 52North.

the class Soap11Encoder method createFaultFromExceptionResponse.

// see
// http://www.angelikalanger.com/GenericsFAQ/FAQSections/ProgrammingIdioms.html#FAQ300
// for more details
private XmlObject createFaultFromExceptionResponse(final OwsExceptionReport owsExceptionReport) throws EncodingException {
    final FaultDocument faultDoc = FaultDocument.Factory.newInstance();
    final Fault fault = faultDoc.addNewFault();
    fault.setFaultcode(SoapConstants.SENDER_FAULT);
    // 19.2.3 SOAP 1.2 Fault Binding
    if (!owsExceptionReport.getExceptions().isEmpty()) {
        final CodedException firstException = owsExceptionReport.getExceptions().get(0);
        fault.addNewDetail().set(encodeObjectToXml(OWSConstants.NS_OWS, firstException, EncodingContext.of(XmlBeansEncodingFlags.ENCODE_OWS_EXCEPTION_ONLY)));
    }
    return faultDoc;
}
Also used : FaultDocument(org.xmlsoap.schemas.soap.envelope.FaultDocument) CodedException(org.n52.shetland.ogc.ows.exception.CodedException) SoapFault(org.n52.shetland.w3c.soap.SoapFault) Fault(org.xmlsoap.schemas.soap.envelope.Fault)

Example 2 with FaultDocument

use of org.xmlsoap.schemas.soap.envelope.FaultDocument in project arctic-sea by 52North.

the class Soap11Encoder method createFault.

private XmlObject createFault(final SoapFault soapFault) {
    final FaultDocument faultDoc = FaultDocument.Factory.newInstance();
    final Fault fault = faultDoc.addNewFault();
    fault.setFaultcode(soapFault.getFaultCode());
    fault.setFaultstring(soapFault.getFaultReason());
    if (soapFault.getDetailText() != null) {
        final XmlString xmlString = XmlString.Factory.newInstance();
        xmlString.setStringValue(soapFault.getDetailText());
        fault.addNewDetail().set(xmlString);
    }
    return faultDoc;
}
Also used : FaultDocument(org.xmlsoap.schemas.soap.envelope.FaultDocument) XmlString(org.apache.xmlbeans.XmlString) SoapFault(org.n52.shetland.w3c.soap.SoapFault) Fault(org.xmlsoap.schemas.soap.envelope.Fault)

Aggregations

SoapFault (org.n52.shetland.w3c.soap.SoapFault)2 Fault (org.xmlsoap.schemas.soap.envelope.Fault)2 FaultDocument (org.xmlsoap.schemas.soap.envelope.FaultDocument)2 XmlString (org.apache.xmlbeans.XmlString)1 CodedException (org.n52.shetland.ogc.ows.exception.CodedException)1