private void validateFault(SoapMessage message, SOAPFault fault, BindingOperationInfo bop) { if (ServiceUtils.isSchemaValidationEnabled(SchemaValidationType.OUT, message)) { Schema schema = EndpointReferenceUtils.getSchema(message.getExchange().getService() .getServiceInfos().get(0), message.getExchange().getBus()); Detail d = fault.getDetail(); try { validateFaultDetail(d, schema, bop); } catch (Exception e) { throw new SoapFault(e.getMessage(), e, message.getVersion().getReceiver()); } //We validated what we can from a fault standpoint message.put(Message.SCHEMA_VALIDATION_ENABLED, Boolean.FALSE); } }
/** Returns the fault detail for the given fault. */ @Override public Detail getFaultDetail(SOAPFault fault) { return fault.getDetail(); }
@Override public Detail getFaultDetail(SOAPFault fault) { return fault.getDetail(); }
@Override public Detail getFaultDetail(SOAPFault fault) { return fault.getDetail(); }
private SoapFault mapSoapFault(SOAPFaultException sfe) { SoapFault sf = new SoapFault(sfe.getFault().getFaultString(), sfe, sfe.getFault().getFaultCodeAsQName()); sf.setRole(sfe.getFault().getFaultActor()); if (sfe.getFault().hasDetail()) { sf.setDetail(sfe.getFault().getDetail()); } return sf; }
soapFault.setFaultActor(sf.getFault().getFaultActor()); if (sf.getFault().hasDetail()) { Node nd = soapMessage.getSOAPPart().importNode(sf.getFault().getDetail(), true); nd = nd.getFirstChild(); soapFault.addDetail(); while (nd != null) { soapFault.getDetail().appendChild(nd); nd = nd.getNextSibling(); nd = nd.getFirstChild(); while (nd != null) { soapFault.getDetail().appendChild(nd); nd = nd.getNextSibling();
while (nd != null) { Node next = nd.getNextSibling(); soapFault.getDetail().appendChild(nd); nd = next;
@Override protected Fault createFault(Throwable ex, Method m, List<Object> params, boolean checked) { //map the JAX-WS faults SOAPFaultException sfe = findSoapFaultException(ex); if (sfe != null) { SoapFault fault = new SoapFault(sfe.getFault().getFaultString(), ex, sfe.getFault().getFaultCodeAsQName()); fault.setRole(sfe.getFault().getFaultActor()); if (sfe.getFault().hasDetail()) { fault.setDetail(sfe.getFault().getDetail()); } return fault; } return super.createFault(ex, m, params, checked); }
private boolean isFileNotFound(SOAPFaultException e) { Detail detail = e.getFault().getDetail(); NodeList childNodes = detail.getChildNodes(); for (int i = 0; i < childNodes.getLength(); ++i) { // I hate soap... if (childNodes.item(i).getNodeName().equals("FileNotFoundFault")) { return true; } } return false; }
@Override public SoapFaultDetail getFaultDetail() { Detail saajDetail = getSaajFault().getDetail(); return saajDetail != null ? new SaajSoapFaultDetail(saajDetail) : null; }
try { //... invoke service via client } catch (javax.xml.ws.soap.SOAPFaultException soapFaultException) { javax.xml.soap.SOAPFault fault = soapFaultException.getFault(); //<Fault> node javax.xml.soap.Detail detail = fault.getDetail(); // <detail> node Iterator detailEntries = detail.getDetailEntries(); //nodes under <detail> //application / service-provider-specific XML nodes (type javax.xml.soap.DetailEntry) from here }
@Override public SoapFaultDetail getFaultDetail() { Detail saajDetail = getSaajFault().getDetail(); return saajDetail != null ? new SaajSoapFaultDetail(saajDetail) : null; }
@Override public SoapFaultDetail getFaultDetail() { Detail saajDetail = getSaajFault().getDetail(); return saajDetail != null ? new SaajSoapFaultDetail(saajDetail) : null; }
SOAP11Fault(SOAPFault fault) { this.faultcode = fault.getFaultCodeAsQName(); this.faultstring = fault.getFaultString(); this.faultactor = fault.getFaultActor(); if (fault.getDetail() != null) { detail = new DetailType(); Iterator iter = fault.getDetail().getDetailEntries(); while(iter.hasNext()){ Element fd = (Element)iter.next(); detail.getDetails().add(fd); } } }
SOAP11Fault(SOAPFault fault) { this.faultcode = fault.getFaultCodeAsQName(); this.faultstring = fault.getFaultString(); this.faultactor = fault.getFaultActor(); if (fault.getDetail() != null) { detail = new DetailType(); Iterator iter = fault.getDetail().getDetailEntries(); while(iter.hasNext()){ Element fd = (Element)iter.next(); detail.getDetails().add(fd); } } }
SOAP11Fault(SOAPFault fault) { this.faultcode = fault.getFaultCodeAsQName(); this.faultstring = fault.getFaultString(); this.faultactor = fault.getFaultActor(); if (fault.getDetail() != null) { detail = new DetailType(); Iterator iter = fault.getDetail().getDetailEntries(); while(iter.hasNext()){ Element fd = (Element)iter.next(); detail.getDetails().add(fd); } } }
public SoapFaultRpcFaultAdapter(SOAPFault f) { super(f.getFaultCode(), f.getFaultString(), f.getDetail().getTextContent()); } }
final SOAPMessage msg = MessageFactory.newInstance(SOAPConstants.SOAP_1_2_PROTOCOL) .createMessage(new MimeHeaders(), new ByteArrayInputStream(yourSoapMessageWithFault.getBytes())); if (msg != null) { SOAPEnvelope env = msg.getSOAPPart().getEnvelope(); SOAPBody body = env.getBody(); if (body != null && body.hasFault()) { final SOAPFault fault = body.getFault(); final DetailEntry entry = (DetailEntry)fault.getDetail().getDetailEntries().next(); //now UNMarshall this entry to your custom exception class.
private SoapFault mapSoapFault(SOAPFaultException sfe) { SoapFault sf = new SoapFault(sfe.getFault().getFaultString(), sfe, sfe.getFault().getFaultCodeAsQName()); sf.setRole(sfe.getFault().getFaultActor()); if (sfe.getFault().hasDetail()) { sf.setDetail(sfe.getFault().getDetail()); } return sf; }