List of usage examples for javax.xml.soap SOAPFault getFaultActor
public String getFaultActor();
From source file:com.legstar.proxy.invoke.jaxws.WebServiceInvoker.java
/** * Try to extract something meaningful from a SOAP Fault. * /*from w w w . j a va 2 s .co m*/ * @param e the SOAP Fault exception * @return a fault description */ @SuppressWarnings("rawtypes") public String getFaultReasonText(final SOAPFaultException e) { if (_log.isDebugEnabled()) { SOAPFault fault = e.getFault(); if (fault != null) { QName code = fault.getFaultCodeAsQName(); String string = fault.getFaultString(); String actor = fault.getFaultActor(); _log.debug("SOAP fault contains: "); _log.debug(" Fault code = " + code.toString()); _log.debug(" Local name = " + code.getLocalPart()); _log.debug(" Namespace prefix = " + code.getPrefix() + ", bound to " + code.getNamespaceURI()); _log.debug(" Fault string = " + string); if (actor != null) { _log.debug(" Fault actor = " + actor); } Detail detail = fault.getDetail(); if (detail != null) { Iterator entries = detail.getDetailEntries(); while (entries.hasNext()) { DetailEntry newEntry = (DetailEntry) entries.next(); String value = newEntry.getValue(); _log.debug(" Detail entry = " + value); } } } else { _log.debug(e); } } SOAPFault fault = e.getFault(); if (fault != null) { StringBuffer faultMessage = new StringBuffer(e.getFault().getFaultString()); Detail detail = fault.getDetail(); if (detail != null) { Iterator entries = detail.getDetailEntries(); while (entries.hasNext()) { DetailEntry newEntry = (DetailEntry) entries.next(); faultMessage.append(" [" + newEntry.getValue() + "]"); } } return faultMessage.toString(); } else { return e.getMessage(); } }
From source file:net.sf.jasperreports.olap.xmla.JRXmlaQueryExecuter.java
protected void handleResultFault(SOAPFault fault) { StringBuilder errorMsg = new StringBuilder(); errorMsg.append("XML/A fault: "); String faultString = fault.getFaultString(); if (faultString != null) { errorMsg.append(faultString);// w w w. j av a 2s.c om errorMsg.append("; "); } String faultActor = fault.getFaultActor(); if (faultActor != null) { errorMsg.append("Actor: "); errorMsg.append(faultActor); errorMsg.append("; "); } String faultCode = fault.getFaultCode(); if (faultCode != null) { errorMsg.append("Code: "); errorMsg.append(faultCode); errorMsg.append("; "); } throw new JRRuntimeException(errorMsg.toString()); }
From source file:org.jasig.portal.security.provider.saml.SAMLDelegatedAuthenticationService.java
/** * Assume that the InputStream has a SOAP fault message and return a String * suitable to present as an exception message * /*from ww w. j a v a 2 s.com*/ * @param is InputStream that contains a SOAP message * @return String containing a formated error message * * @throws IOException * @throws SOAPException */ private String getSOAPFaultAsString(InputStream is) throws IOException, SOAPException { is.reset(); MessageFactory factory = MessageFactory.newInstance(); SOAPMessage message = factory.createMessage(null, is); SOAPBody body = message.getSOAPBody(); if (body.hasFault()) { SOAPFault fault = body.getFault(); String code, string, actor; code = fault.getFaultCode(); string = fault.getFaultString(); actor = fault.getFaultActor(); String formatedMessage = "SOAP transaction resulted in a SOAP fault."; if (code != null) formatedMessage += " Code=\"" + code + ".\""; if (string != null) formatedMessage += " String=\"" + string + ".\""; if (actor != null) formatedMessage += " Actor=\"" + actor + ".\""; return formatedMessage; } return null; }
From source file:com.jaspersoft.ireport.designer.data.fieldsproviders.olap.OLAPQueryExecuter.java
protected void handleResultFault(SOAPFault fault) { StringBuffer errorMsg = new StringBuffer(); errorMsg.append("XML/A fault: "); String faultString = fault.getFaultString(); if (faultString != null) { errorMsg.append(faultString);/*from ww w. j a va 2 s. co m*/ errorMsg.append("; "); } String faultActor = fault.getFaultActor(); if (faultActor != null) { errorMsg.append("Actor: "); errorMsg.append(faultActor); errorMsg.append("; "); } String faultCode = fault.getFaultCode(); if (faultCode != null) { errorMsg.append("Code: "); errorMsg.append(faultCode); errorMsg.append("; "); } throw new JRRuntimeException(errorMsg.toString()); }
From source file:org.pentaho.platform.plugin.action.xmla.XMLABaseComponent.java
/** * check SOAP reply for Error, return fault Code * * @param reply the message to check//from www . ja va 2s . c o m * @param aReturn ArrayList containing faultcode,faultstring,faultactor */ private boolean soapFault(final SOAPMessage reply, final String[] faults) throws SOAPException { SOAPPart sp = reply.getSOAPPart(); SOAPEnvelope envelope = sp.getEnvelope(); SOAPBody body = envelope.getBody(); if (!body.hasFault()) { return false; } SOAPFault fault = body.getFault(); faults[0] = fault.getFaultCode(); faults[1] = fault.getFaultString(); faults[2] = fault.getFaultActor(); // probably not neccessary with Microsoft; Detail detail = fault.getDetail(); if (detail == null) { return true; } String detailMsg = ""; //$NON-NLS-1$ Iterator it = detail.getDetailEntries(); for (; it.hasNext();) { DetailEntry det = (DetailEntry) it.next(); Iterator ita = det.getAllAttributes(); for (boolean cont = false; ita.hasNext(); cont = true) { Name name = (Name) ita.next(); if (cont) { detailMsg += "; "; //$NON-NLS-1$ } detailMsg += name.getLocalName(); detailMsg += " = "; //$NON-NLS-1$ detailMsg += det.getAttributeValue(name); } } faults[3] = detailMsg; return true; }