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;
}
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;
}
Aggregations