Example usage for javax.xml.soap DetailEntry getAttributeValue

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

Introduction

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

Prototype

public String getAttributeValue(Name name);

Source Link

Document

Returns the value of the attribute with the specified name.

Usage

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   ww w  . jav a 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;
}