Example usage for javax.xml.soap DetailEntry getValue

List of usage examples for javax.xml.soap DetailEntry getValue

Introduction

In this page you can find the example usage for javax.xml.soap DetailEntry getValue.

Prototype

public String getValue();

Source Link

Document

Returns the value of this node if this is a Text node or the value of the immediate child of this node otherwise.

Usage

From source file:com.legstar.proxy.invoke.jaxws.WebServiceInvoker.java

/**
 * Try to extract something meaningful from a SOAP Fault.
 * //  ww w. ja v a  2s  .  c  om
 * @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();
    }

}