@Override public void setFaultReasonText(SOAPFault fault, Locale locale, String text) throws SOAPException { fault.addFaultReasonText(text, locale); }
@Override public void setFaultReasonText(Locale locale, String text) { try { getSaajFault().addFaultReasonText(text, locale); } catch (SOAPException ex) { throw new SaajSoapFaultException(ex); } }
@Override public void setFaultReasonText(Locale locale, String text) { try { getSaajFault().addFaultReasonText(text, locale); } catch (SOAPException ex) { throw new SaajSoapFaultException(ex); } }
@Override public void setFaultReasonText(Locale locale, String text) { try { getSaajFault().addFaultReasonText(text, locale); } catch (SOAPException ex) { throw new SaajSoapFaultException(ex); } }
fault.setFaultCode(fault_name); fault.setFaultRole("http://ticket.example.com/versionNumber_validator"); fault.addFaultReasonText(reason, Locale.US); } catch (SOAPException e) {
// Create a new SOAP 1.2 message from the message factory and obtain the SOAP body MessageFactory factory = MessageFactory.newInstance(SOAPConstants.SOAP_1_2_PROTOCOL); SOAPMessage message = factory.createMessage(); SOAPBody soapBody = message.getSOAPPart().getEnvelope().getBody(); // get the fault SOAPFault fault = soapBody.addFault(); // since this is an error generated from the business application // where SOAPValue is the standard value code "Sender|Reciever...etc" QName faultName = new QName(SOAPConstants.URI_NS_SOAP_1_2_ENVELOPE, SOAPValue); fault.setFaultCode(faultName); // set the fault reason text // where languageLocale is the passed language local, the Locale object can be used fault.addFaultReasonText(errorMessage, languageLocale); // generate the detail Detail detail = fault.addDetail(); // add the error code entry QName customCodeEntryName = new QName("http://www.example.com/", "customCode", "ns1"); DetailEntry customCodeEntry = detail.addDetailEntry(customCodeEntryName); customCodeEntry.addTextNode("this is custom 123 code"); // throw the exception that shall generate the SOAP fault response XML message throw new SOAPFaultException(fault);
/** * Creates a new SOAPFault object initialized with the given reasonText and faultCode * * @param reasonText - the ReasonText/FaultString for the fault faultCode - the FaultCode for * the fault * @return: a SOAPFault object * @throws: SOAPException - if there is a SOAP error */ public SOAPFault createFault(String reasonText, QName faultCode) throws SOAPException { SOAPFault soapFault; if (soapVersion.equals(SOAPConstants.SOAP_1_2_PROTOCOL)) { soapFault = new SOAPFaultImpl(metaFactory.getSOAP12Factory() .createSOAPFault()); } else { soapFault = new SOAPFaultImpl(metaFactory.getSOAP11Factory() .createSOAPFault()); } soapFault.setFaultCode(faultCode); try { soapFault.addFaultReasonText(reasonText, Locale.getDefault()); } catch (UnsupportedOperationException e) { throw new SOAPException(e.getMessage()); } return soapFault; }
/** * Creates a new SOAPFault object initialized with the given reasonText and faultCode * * @param reasonText - the ReasonText/FaultString for the fault faultCode - the FaultCode for * the fault * @return: a SOAPFault object * @throws: SOAPException - if there is a SOAP error */ public SOAPFault createFault(String reasonText, QName faultCode) throws SOAPException { SOAPFault soapFault; if (soapVersion.equals(SOAPConstants.SOAP_1_2_PROTOCOL)) { soapFault = new SOAPFaultImpl(metaFactory.getSOAP12Factory() .createSOAPFault()); } else { soapFault = new SOAPFaultImpl(metaFactory.getSOAP11Factory() .createSOAPFault()); } soapFault.setFaultCode(faultCode); try { soapFault.addFaultReasonText(reasonText, Locale.getDefault()); } catch (UnsupportedOperationException e) { throw new SOAPException(e.getMessage()); } return soapFault; }
soapFault.addFaultReasonText(SoapHelper.getSoapFaultReasonText(firstException.getCode()), Locale.ENGLISH); Detail detail = soapFault.addDetail(); for (CodedException exception : owsExceptionReport.getExceptions()) {
soapFault.addFaultReasonText(SoapHelper.getSoapFaultReasonText(firstException.getCode()), Locale.ENGLISH); Detail detail = soapFault.addDetail(); for (CodedException exception : owsExceptionReport.getExceptions()) {