use of org.w3.x2003.x05.soapEnvelope.Subcode in project arctic-sea by 52North.
the class Soap12Encoder method createSOAP12FaultFromExceptionResponse.
// see
// http://www.angelikalanger.com/GenericsFAQ/FAQSections/ProgrammingIdioms.html#FAQ300
// for more details
private XmlObject createSOAP12FaultFromExceptionResponse(final OwsExceptionReport owsExceptionReport) throws EncodingException {
final FaultDocument faultDoc = FaultDocument.Factory.newInstance();
final Fault fault = faultDoc.addNewFault();
final Faultcode code = fault.addNewCode();
code.setValue(SOAPConstants.SOAP_SENDER_FAULT);
// 19.2.3 SOAP 1.2 Fault Binding
if (!owsExceptionReport.getExceptions().isEmpty()) {
final CodedException firstException = owsExceptionReport.getExceptions().get(0);
final Subcode subcode = code.addNewSubcode();
QName qName;
if (firstException.getCode() != null) {
qName = OwsHelper.getQNameForLocalName(firstException.getCode().toString());
} else {
qName = OwsHelper.getQNameForLocalName(OwsExceptionCode.NoApplicableCode.name());
}
subcode.setValue(qName);
final Reasontext addNewText = fault.addNewReason().addNewText();
addNewText.setLang(Locale.ENGLISH.getLanguage());
addNewText.setStringValue(SoapHelper.getSoapFaultReasonText(firstException.getCode()));
fault.addNewDetail().set(encodeObjectToXml(OWSConstants.NS_OWS, firstException, EncodingContext.of(XmlBeansEncodingFlags.ENCODE_OWS_EXCEPTION_ONLY)));
}
return faultDoc;
}
Aggregations