Search in sources :

Example 61 with SOAPEnvelope

use of javax.xml.soap.SOAPEnvelope in project pentaho-platform by pentaho.

the class XMLABaseComponent method findDiscoverRoot.

/**
 * locate "root" in DisoverResponse
 */
private SOAPElement findDiscoverRoot(final SOAPMessage reply) throws SOAPException, XMLAException {
    SOAPPart sp = reply.getSOAPPart();
    SOAPEnvelope envelope = sp.getEnvelope();
    SOAPBody body = envelope.getBody();
    Name childName;
    SOAPElement eResponse = null;
    if (provider == 0) {
        // unknown provider - recognize by prefix of DiscoverResponse
        Iterator itBody = body.getChildElements();
        while (itBody.hasNext()) {
            Node n = (Node) itBody.next();
            if (!(n instanceof SOAPElement)) {
                continue;
            }
            Name name = ((SOAPElement) n).getElementName();
            if (name.getLocalName().equals("DiscoverResponse")) {
                // $NON-NLS-1$
                eResponse = (SOAPElement) n;
                provider = getProviderFromDiscoverResponse(envelope, eResponse);
                break;
            }
        }
        if (eResponse == null) {
            throw new XMLAException(// $NON-NLS-1$
            Messages.getInstance().getString("XMLABaseComponent.ERROR_0013_NO_DISCOVER_RESPONSE"));
        }
    } else {
        if ((provider == XMLABaseComponent.PROVIDER_MICROSOFT) || (provider == XMLABaseComponent.PROVIDER_ESSBASE)) {
            // Microsoft
            // or
            // Essbase
            childName = // $NON-NLS-1$ //$NON-NLS-2$
            envelope.createName("DiscoverResponse", "m", XMLABaseComponent.XMLA_URI);
        } else if ((provider == XMLABaseComponent.PROVIDER_SAP) || (provider == XMLABaseComponent.PROVIDER_MONDRIAN)) {
            // SAP
            // or
            // Mondrian
            childName = // $NON-NLS-1$ //$NON-NLS-2$
            envelope.createName("DiscoverResponse", "", XMLABaseComponent.XMLA_URI);
        } else {
            throw new IllegalArgumentException(Messages.getInstance().getString(// $NON-NLS-1$
            "XMLABaseComponent.ERROR_0014_NO_PROVIDER_SPEC"));
        }
        eResponse = selectSingleNode(body, childName);
        if (eResponse == null) {
            throw new XMLAException(Messages.getInstance().getString(// $NON-NLS-1$
            "XMLABaseComponent.ERROR_0015_NO_DISCOVER_RESPONSE_ELEMENT"));
        }
    }
    SOAPElement eReturn = getDiscoverReturn(envelope, eResponse);
    if (eReturn == null) {
        throw new XMLAException(Messages.getInstance().getString(// $NON-NLS-1$
        "XMLABaseComponent.ERROR_0016_NO_RESULT_RETURN_ELEMENT"));
    }
    SOAPElement eRoot = getDiscoverRoot(envelope, eReturn);
    if (eRoot == null) {
        throw new XMLAException(// $NON-NLS-1$
        Messages.getInstance().getString("XMLABaseComponent.ERROR_0017_NO_RESULT_ROOT_ELEMENT"));
    }
    return eRoot;
}
Also used : SOAPBody(javax.xml.soap.SOAPBody) Node(javax.xml.soap.Node) SOAPPart(javax.xml.soap.SOAPPart) SOAPElement(javax.xml.soap.SOAPElement) Iterator(java.util.Iterator) SOAPEnvelope(javax.xml.soap.SOAPEnvelope) Name(javax.xml.soap.Name)

Example 62 with SOAPEnvelope

use of javax.xml.soap.SOAPEnvelope in project pentaho-platform by pentaho.

the class XMLABaseComponent method findExecRoot.

/**
 * locate "root" in ExecuteResponse
 */
private SOAPElement findExecRoot(final SOAPMessage reply) throws SOAPException, XMLAException {
    SOAPPart sp = reply.getSOAPPart();
    SOAPEnvelope envelope = sp.getEnvelope();
    SOAPBody body = envelope.getBody();
    Name name;
    // $NON-NLS-1$//$NON-NLS-2$
    name = envelope.createName("ExecuteResponse", "m", XMLABaseComponent.XMLA_URI);
    SOAPElement eResponse = selectSingleNode(body, name);
    if (eResponse == null) {
        throw new XMLAException(Messages.getInstance().getString(// $NON-NLS-1$
        "XMLABaseComponent.ERROR_0011_NO_EXECUTE_RESPONSE_ELEMENT"));
    }
    // $NON-NLS-1$//$NON-NLS-2$
    name = envelope.createName("return", "m", XMLABaseComponent.XMLA_URI);
    SOAPElement eReturn = selectSingleNode(eResponse, name);
    // $NON-NLS-1$//$NON-NLS-2$
    name = envelope.createName("root", "", XMLABaseComponent.MDD_URI);
    SOAPElement eRoot = selectSingleNode(eReturn, name);
    if (eRoot == null) {
        throw new XMLAException(Messages.getInstance().getString("XMLABaseComponent.ERROR_0012_NO_RESPONSE_ROOT_ELEMENT"));
    }
    // $NON-NLS-1$
    return eRoot;
}
Also used : SOAPBody(javax.xml.soap.SOAPBody) SOAPPart(javax.xml.soap.SOAPPart) SOAPElement(javax.xml.soap.SOAPElement) SOAPEnvelope(javax.xml.soap.SOAPEnvelope) Name(javax.xml.soap.Name)

Aggregations

SOAPEnvelope (javax.xml.soap.SOAPEnvelope)62 SOAPMessage (javax.xml.soap.SOAPMessage)37 SOAPException (javax.xml.soap.SOAPException)32 SOAPPart (javax.xml.soap.SOAPPart)26 SOAPBody (javax.xml.soap.SOAPBody)25 SOAPElement (javax.xml.soap.SOAPElement)22 SOAPHeader (javax.xml.soap.SOAPHeader)17 SOAPHeaderElement (javax.xml.soap.SOAPHeaderElement)14 Name (javax.xml.soap.Name)13 Iterator (java.util.Iterator)12 QName (javax.xml.namespace.QName)12 WebServiceException (javax.xml.ws.WebServiceException)10 MessageFactory (javax.xml.soap.MessageFactory)8 ProtocolException (javax.xml.ws.ProtocolException)7 SOAPMessageContext (javax.xml.ws.handler.soap.SOAPMessageContext)6 CoordinationContextType (org.oasis_open.docs.ws_tx.wscoor._2006._06.CoordinationContextType)6 Document (org.w3c.dom.Document)6 Detail (javax.xml.soap.Detail)5 SOAPConnection (javax.xml.soap.SOAPConnection)5 SOAPFault (javax.xml.soap.SOAPFault)5