Example usage for javax.xml.soap SOAPMessage getSOAPPart

List of usage examples for javax.xml.soap SOAPMessage getSOAPPart

Introduction

In this page you can find the example usage for javax.xml.soap SOAPMessage getSOAPPart.

Prototype

public abstract SOAPPart getSOAPPart();

Source Link

Document

Gets the SOAP part of this SOAPMessage object.

Usage

From source file:com.ibm.soatf.component.soap.SOAPComponent.java

private void checkSOAPMessage(boolean ok) throws SoapComponentException {
    ProgressMonitor.init(2, "Loading message from file...");
    String filename = new StringBuilder(serviceName).append(NAME_DELIMITER).append(operationName)
            .append(NAME_DELIMITER).append(RESPONSE_FILE_SUFFIX).toString();
    final File file = new File(workingDir, filename);
    InputStream is = null;//from w w  w .  j  a v a2s  .  c o m
    try {
        final byte[] xmlMessage = FileUtils.readFileToByteArray(file);
        is = new ByteArrayInputStream(xmlMessage);
        SOAPMessage response = MessageFactory.newInstance(SOAPConstants.SOAP_1_1_PROTOCOL)
                .createMessage(new MimeHeaders(), is);
        ProgressMonitor.increment("Checking for fault...");
        response.removeAllAttachments();
        SOAPEnvelope envp = response.getSOAPPart().getEnvelope();
        SOAPBody someBody = envp.getBody();
        if (ok) {
            if (someBody.getFault() == null) {
                cor.addMsg("soap body is OK");
                cor.markSuccessful();
            } else {
                final String msg = "found soap fault in response body:\n" + new String(xmlMessage);
                cor.addMsg(msg);
                throw new SoapComponentException(msg);
            }
        } else {
            if (someBody.getFault() != null) {
                cor.addMsg("found soap fault in response body");
                cor.markSuccessful();
            } else {
                final String msg = "response body doesn't contain soap fault:\n" + new String(xmlMessage);
                cor.addMsg(msg);
                throw new SoapComponentException(msg);
            }
        }
    } catch (IOException | SOAPException ex) {
        throw new SoapComponentException("error while trying to parse response", ex);
    } finally {
        if (is != null) {
            try {
                is.close();
            } catch (IOException ex) {
                logger.debug("Not able to close input stream. ", ex);
            }
        }
    }
}

From source file:net.sf.jasperreports.olap.xmla.JRXmlaQueryExecuter.java

/**
 * Parses the result-Message into this class's structure
 * //from  w w w  .j ava 2s. co m
 * @param reply
 *            The reply-Message from the Server
 */
protected void parseResult(SOAPMessage reply) throws SOAPException {
    SOAPPart soapPart = reply.getSOAPPart();
    SOAPEnvelope soapEnvelope = soapPart.getEnvelope();
    SOAPBody soapBody = soapEnvelope.getBody();
    SOAPElement eElement = null;

    if (log.isDebugEnabled()) {
        log.debug("XML/A result envelope: " + prettyPrintSOAP(soapEnvelope));
    }

    SOAPFault fault = soapBody.getFault();
    if (fault != null) {
        handleResultFault(fault);
    }

    Name eName = soapEnvelope.createName("ExecuteResponse", "", XMLA_URI);

    // Get the ExecuteResponse-Node
    Iterator<?> responseElements = soapBody.getChildElements(eName);
    if (responseElements.hasNext()) {
        Object eObj = responseElements.next();
        if (eObj == null) {
            throw new JRRuntimeException(EXCEPTION_MESSAGE_KEY_XMLA_NULL_ELEMENT,
                    new Object[] { "ExecuteResponse" });
        }
        eElement = (SOAPElement) eObj;
    } else {
        throw new JRRuntimeException(EXCEPTION_MESSAGE_KEY_XMLA_CANNOT_RETRIEVE_ELEMENT,
                new Object[] { "ExecuteResponse" });
    }

    // Get the return-Node
    Name rName = soapEnvelope.createName("return", "", XMLA_URI);
    Iterator<?> returnElements = eElement.getChildElements(rName);
    SOAPElement returnElement = null;
    if (returnElements.hasNext()) {
        Object eObj = returnElements.next();
        if (eObj == null) {
            throw new JRRuntimeException(EXCEPTION_MESSAGE_KEY_XMLA_NULL_ELEMENT, new Object[] { "return" });
        }
        returnElement = (SOAPElement) eObj;
    } else {
        // Should be old-Microsoft XMLA-SDK. Try without m-prefix
        Name rName2 = soapEnvelope.createName("return", "", "");
        returnElements = eElement.getChildElements(rName2);
        if (returnElements.hasNext()) {
            Object eObj = returnElements.next();
            if (eObj == null) {
                throw new JRRuntimeException(EXCEPTION_MESSAGE_KEY_XMLA_NULL_ELEMENT,
                        new Object[] { "return" });
            }
            returnElement = (SOAPElement) eObj;
        } else {
            throw new JRRuntimeException(EXCEPTION_MESSAGE_KEY_XMLA_CANNOT_RETRIEVE_ELEMENT,
                    new Object[] { "return" });
        }
    }

    // Get the root-Node
    Name rootName = soapEnvelope.createName("root", "", MDD_URI);
    SOAPElement rootElement = null;
    Iterator<?> rootElements = returnElement.getChildElements(rootName);
    if (rootElements.hasNext()) {
        Object eObj = rootElements.next();
        if (eObj == null) {
            throw new JRRuntimeException(EXCEPTION_MESSAGE_KEY_XMLA_NULL_ELEMENT, new Object[] { "root" });
        }
        rootElement = (SOAPElement) eObj;
    } else {
        throw new JRRuntimeException(EXCEPTION_MESSAGE_KEY_XMLA_CANNOT_RETRIEVE_ELEMENT,
                new Object[] { "root" });
    }
    // Get the OlapInfo-Node
    Name olapInfoName = soapEnvelope.createName("OlapInfo", "", MDD_URI);
    SOAPElement olapInfoElement = null;
    Iterator<?> olapInfoElements = rootElement.getChildElements(olapInfoName);
    if (olapInfoElements.hasNext()) {
        Object eObj = olapInfoElements.next();
        if (eObj == null) {
            throw new JRRuntimeException(EXCEPTION_MESSAGE_KEY_XMLA_NULL_ELEMENT, new Object[] { "OlapInfo" });
        }
        olapInfoElement = (SOAPElement) eObj;
    } else {
        throw new JRRuntimeException(EXCEPTION_MESSAGE_KEY_XMLA_CANNOT_RETRIEVE_ELEMENT,
                new Object[] { "OlapInfo" });
    }

    parseOLAPInfoElement(olapInfoElement);

    // Get the Axes Element
    Name axesName = soapEnvelope.createName("Axes", "", MDD_URI);
    SOAPElement axesElement = null;
    Iterator<?> axesElements = rootElement.getChildElements(axesName);
    if (axesElements.hasNext()) {
        Object eObj = axesElements.next();
        if (eObj == null) {
            throw new JRRuntimeException(EXCEPTION_MESSAGE_KEY_XMLA_NULL_ELEMENT, new Object[] { "Axes" });
        }
        axesElement = (SOAPElement) eObj;
    } else {
        throw new JRRuntimeException(EXCEPTION_MESSAGE_KEY_XMLA_CANNOT_RETRIEVE_ELEMENT,
                new Object[] { "Axes" });
    }

    parseAxesElement(axesElement);

    // Get the CellData Element
    Name cellDataName = soapEnvelope.createName("CellData", "", MDD_URI);
    SOAPElement cellDataElement = null;
    Iterator<?> cellDataElements = rootElement.getChildElements(cellDataName);
    if (cellDataElements.hasNext()) {
        Object eObj = cellDataElements.next();
        if (eObj == null) {
            throw new JRRuntimeException(EXCEPTION_MESSAGE_KEY_XMLA_NULL_ELEMENT, new Object[] { "CellData" });
        }
        cellDataElement = (SOAPElement) eObj;
    } else {
        throw new JRRuntimeException(EXCEPTION_MESSAGE_KEY_XMLA_CANNOT_RETRIEVE_ELEMENT,
                new Object[] { "CellData" });
    }
    parseCellDataElement(cellDataElement);
}

From source file:it.cnr.icar.eric.common.SOAPMessenger.java

Reader processResponseBody(SOAPMessage response, String lookFor)
        throws JAXRException, SOAPException, TransformerConfigurationException, TransformerException {
    // grab info out of reply
    SOAPPart replyPart = response.getSOAPPart();
    Source replySource = replyPart.getContent();

    // transform/* ww w  .j a  v  a  2s .  c o  m*/
    TransformerFactory tFactory = TransformerFactory.newInstance();
    Transformer xFormer = tFactory.newTransformer();
    DOMResult domResult = new DOMResult();
    xFormer.transform(replySource, domResult);

    org.w3c.dom.Node node = domResult.getNode();

    while (node != null) {
        String nodeLocalName = node.getLocalName();

        if ((nodeLocalName != null) && (nodeLocalName.endsWith(lookFor))) {
            break;
        }

        node = nextNode(node);
    }

    if (node == null) {
        node = domResult.getNode();
        while (node != null) {
            String nodeLocalName = node.getLocalName();
            if ((nodeLocalName != null) && (nodeLocalName.endsWith(lookFor))) {
                break;
            }

            node = nextNode(node);
        }

        throw new JAXRException(resourceBundle.getString("message.elementNotFound", new String[] { lookFor }));
    }

    return domNode2StringReader(node);
}

From source file:com.nortal.jroad.endpoint.AbstractXTeeBaseEndpoint.java

@SuppressWarnings("unchecked")
protected SOAPElement createXteeMessageStructure(SOAPMessage requestMessage, SOAPMessage responseMessage)
        throws Exception {
    SOAPUtil.addBaseMimeHeaders(responseMessage);
    SOAPUtil.addBaseNamespaces(responseMessage);
    if (!metaService) {
        // Assign xroad namespaces according to request
        List<String> xteeNamespaces = new ArrayList<String>();
        xteeNamespaces.add(version.getNamespaceUri());
        if (XRoadProtocolVersion.V4_0 == version) {
            xteeNamespaces.add(XTeeWsdlDefinition.XROAD_IDEN_NAMESPACE);
        }//from w ww  .  j av  a  2 s. co m

        Iterator<String> prefixes = requestMessage.getSOAPPart().getEnvelope().getNamespacePrefixes();
        while (prefixes.hasNext()) {
            String nsPrefix = (String) prefixes.next();
            String nsURI = requestMessage.getSOAPPart().getEnvelope().getNamespaceURI(nsPrefix).toLowerCase();
            if (xteeNamespaces.contains(nsURI)) {
                SOAPUtil.addNamespace(responseMessage, nsPrefix, nsURI);
            }
        }

        // Copy headers from request
        NodeList reqHeaders = requestMessage.getSOAPHeader().getChildNodes();
        for (int i = 0; i < reqHeaders.getLength(); i++) {
            Node reqHeader = reqHeaders.item(i);
            if (reqHeader.getNodeType() != Node.ELEMENT_NODE) {
                continue;
            }
            Node rspHeader = responseMessage.getSOAPPart().importNode(reqHeader, true);
            responseMessage.getSOAPHeader().appendChild(rspHeader);
        }
    }
    responseMessage.getSOAPPart().getEnvelope().setEncodingStyle("http://schemas.xmlsoap.org/soap/encoding/");

    Node teenusElement = SOAPUtil.getFirstNonTextChild(requestMessage.getSOAPBody());
    if (teenusElement.getPrefix() == null || teenusElement.getNamespaceURI() == null) {
        throw new IllegalStateException("Service request is missing namespace.");
    }
    SOAPUtil.addNamespace(responseMessage, teenusElement.getPrefix(), teenusElement.getNamespaceURI());

    String teenusElementName = teenusElement.getLocalName();
    if (teenusElementName.endsWith(SuffixBasedMessagesProvider.DEFAULT_REQUEST_SUFFIX)) {
        teenusElementName = teenusElementName.substring(0,
                teenusElementName.lastIndexOf(SuffixBasedMessagesProvider.DEFAULT_REQUEST_SUFFIX));
    }
    teenusElementName += SuffixBasedMessagesProvider.DEFAULT_RESPONSE_SUFFIX;
    return responseMessage.getSOAPBody().addChildElement(teenusElementName, teenusElement.getPrefix(),
            teenusElement.getNamespaceURI());
}

From source file:org.jasig.portal.security.provider.saml.SAMLDelegatedAuthenticationService.java

private Document createSOAPFaultDocument(String faultString) throws SOAPException {
    MessageFactory factory = MessageFactory.newInstance();
    SOAPMessage message = factory.createMessage();
    SOAPPart sp = message.getSOAPPart();
    SOAPEnvelope se = sp.getEnvelope();
    se.setPrefix(SOAP_PREFIX);//from   w  w  w  . j a va 2 s .c  om
    se.getHeader().detachNode();
    se.addHeader();
    se.getBody().detachNode();
    SOAPBody body = se.addBody();
    SOAPFault fault = body.addFault();
    Name faultCode = se.createName("Client", null, SOAPConstants.URI_NS_SOAP_ENVELOPE);
    fault.setFaultCode(faultCode);
    fault.setFaultString(faultString);
    return se.getOwnerDocument();
}

From source file:net.sf.jasperreports.olap.xmla.JRXmlaQueryExecuter.java

protected SOAPMessage createQueryMessage() {
    String queryStr = getQueryString();

    if (log.isDebugEnabled()) {
        log.debug("MDX query: " + queryStr);
    }//from w ww  . j  a  v  a  2s.co m

    try {
        MessageFactory mf = MessageFactory.newInstance();
        SOAPMessage message = mf.createMessage();

        MimeHeaders mh = message.getMimeHeaders();
        mh.setHeader("SOAPAction", "\"urn:schemas-microsoft-com:xml-analysis:Execute\"");

        SOAPPart soapPart = message.getSOAPPart();
        SOAPEnvelope envelope = soapPart.getEnvelope();
        SOAPBody body = envelope.getBody();
        Name nEx = envelope.createName("Execute", "", XMLA_URI);

        SOAPElement eEx = body.addChildElement(nEx);

        // add the parameters

        // COMMAND parameter
        // <Command>
        // <Statement>queryStr</Statement>
        // </Command>
        Name nCom = envelope.createName("Command", "", XMLA_URI);
        SOAPElement eCommand = eEx.addChildElement(nCom);
        Name nSta = envelope.createName("Statement", "", XMLA_URI);
        SOAPElement eStatement = eCommand.addChildElement(nSta);
        eStatement.addTextNode(queryStr);

        // <Properties>
        // <PropertyList>
        // <DataSourceInfo>dataSource</DataSourceInfo>
        // <Catalog>catalog</Catalog>
        // <Format>Multidimensional</Format>
        // <AxisFormat>TupleFormat</AxisFormat>
        // </PropertyList>
        // </Properties>
        Map<String, String> paraList = new HashMap<String, String>();
        String datasource = (String) getParameterValue(JRXmlaQueryExecuterFactory.PARAMETER_XMLA_DATASOURCE);
        paraList.put("DataSourceInfo", datasource);
        String catalog = (String) getParameterValue(JRXmlaQueryExecuterFactory.PARAMETER_XMLA_CATALOG);
        paraList.put("Catalog", catalog);
        paraList.put("Format", "Multidimensional");
        paraList.put("AxisFormat", "TupleFormat");
        addParameterList(envelope, eEx, "Properties", "PropertyList", paraList);
        message.saveChanges();

        if (log.isDebugEnabled()) {
            log.debug("XML/A query message: \n" + prettyPrintSOAP(message.getSOAPPart().getEnvelope()));
        }

        return message;
    } catch (SOAPException e) {
        throw new JRRuntimeException(e);
    }
}

From source file:it.cnr.icar.eric.server.interfaces.soap.RegistryBSTServlet.java

public SOAPMessage onMessage(SOAPMessage msg, HttpServletRequest req, HttpServletResponse resp) {
    //System.err.println("onMessage called for RegistrySOAPServlet");
    SOAPMessage soapResponse = null;
    SOAPHeader sh = null;/*  www . j a v a 2  s .c  o  m*/

    try {
        // set 'sh' variable ASAP (before "firstly")
        SOAPPart sp = msg.getSOAPPart();
        SOAPEnvelope se = sp.getEnvelope();
        SOAPBody sb = se.getBody();
        sh = se.getHeader();

        // Firstly we put save the attached repository items in a map
        HashMap<String, Object> idToRepositoryItemMap = new HashMap<String, Object>();
        Iterator<?> apIter = msg.getAttachments();
        while (apIter.hasNext()) {
            AttachmentPart ap = (AttachmentPart) apIter.next();

            //Get the content for the attachment
            RepositoryItem ri = processIncomingAttachment(ap);
            idToRepositoryItemMap.put(ri.getId(), ri);
        }

        // Log received message
        //if (log.isTraceEnabled()) {
        // Warning! BAOS.toString() uses platform's default encoding
        /*
        ByteArrayOutputStream msgOs = new ByteArrayOutputStream();
        msg.writeTo(msgOs);
        msgOs.close();
        System.err.println(msgOs.toString());
        */
        //System.err.println(sb.getTextContent());
        //    log.trace("incoming message:\n" + msgOs.toString());
        //}

        // verify signature
        // returns false if no security header, throws exception if invalid
        CredentialInfo credentialInfo = new CredentialInfo();

        boolean noRegRequired = Boolean.valueOf(
                CommonProperties.getInstance().getProperty("eric.common.noUserRegistrationRequired", "false"))
                .booleanValue();

        if (!noRegRequired) {
            WSS4JSecurityUtilBST.verifySOAPEnvelopeOnServerBST(se, credentialInfo);
        }

        //The ebXML registry request is the only element in the SOAPBody
        StringWriter requestXML = new StringWriter(); //The request as an XML String
        String requestRootElement = null;
        Iterator<?> iter = sb.getChildElements();
        int i = 0;

        while (iter.hasNext()) {
            Object obj = iter.next();

            if (!(obj instanceof SOAPElement)) {
                continue;
            }

            if (i++ == 0) {
                SOAPElement elem = (SOAPElement) obj;
                Name name = elem.getElementName();
                requestRootElement = name.getLocalName();

                StreamResult result = new StreamResult(requestXML);

                TransformerFactory tf = TransformerFactory.newInstance();
                Transformer trans = tf.newTransformer();
                trans.transform(new DOMSource(elem), result);
            } else {
                throw new RegistryException(
                        ServerResourceBundle.getInstance().getString("message.invalidRequest"));
            }
        }

        if (requestRootElement == null) {
            throw new RegistryException(
                    ServerResourceBundle.getInstance().getString("message.noebXMLRegistryRequest"));
        }

        // unmarshalling request to message
        Object message = bu.getRequestObject(requestRootElement, requestXML.toString());

        if (message instanceof JAXBElement<?>) {
            // If Element; take ComplexType from Element
            message = ((JAXBElement<?>) message).getValue();

        }

        // request sets ServerContext with ComplexType: RegistryObjectType
        BSTRequest request = new BSTRequest(req, credentialInfo, message, idToRepositoryItemMap);

        Response response = request.process();

        // response.getMessage() is ComplexType again

        soapResponse = createResponseSOAPMessage(response);

        if (response.getIdToRepositoryItemMap().size() > 0 && (response.getMessage().getStatus()
                .equals(BindingUtility.CANONICAL_RESPONSE_STATUS_TYPE_ID_Success))) {

            idToRepositoryItemMap = response.getIdToRepositoryItemMap();
            Iterator<?> mapKeysIter = idToRepositoryItemMap.keySet().iterator();

            while (mapKeysIter.hasNext()) {
                String id = (String) mapKeysIter.next();
                RepositoryItem repositoryItem = (RepositoryItem) idToRepositoryItemMap.get(id);

                String cid = WSS4JSecurityUtilBST.convertUUIDToContentId(id);
                DataHandler dh = repositoryItem.getDataHandler();
                AttachmentPart ap = soapResponse.createAttachmentPart(dh);
                ap.setMimeHeader("Content-Type", "text/xml");
                ap.setContentId(cid);
                soapResponse.addAttachmentPart(ap);

                if (log.isTraceEnabled()) {
                    log.trace("adding attachment: contentId=" + id);
                }
            }

        }

    } catch (Throwable t) {
        //Do not log ObjectNotFoundException as it clutters the log
        if (!(t instanceof ObjectNotFoundException)) {
            log.error(ServerResourceBundle.getInstance().getString("message.CaughtException",
                    new Object[] { t.getMessage() }), t);
            Throwable cause = t.getCause();
            while (cause != null) {
                log.error(ServerResourceBundle.getInstance().getString("message.CausedBy",
                        new Object[] { cause.getMessage() }), cause);
                cause = cause.getCause();
            }
        }

        soapResponse = createFaultSOAPMessage(t, sh);
    }

    if (log.isTraceEnabled()) {
        try {
            ByteArrayOutputStream rspOs = new ByteArrayOutputStream();
            soapResponse.writeTo(rspOs);
            rspOs.close();
            // Warning! BAOS.toString() uses platform's default encoding
            log.trace("response message:\n" + rspOs.toString());
        } catch (Exception e) {
            log.error(ServerResourceBundle.getInstance().getString("message.FailedToLogResponseMessage",
                    new Object[] { e.getMessage() }), e);
        }
    }
    return soapResponse;
}

From source file:com.offbynull.portmapper.upnpigd.UpnpIgdController.java

private byte[] createRequestXml(String action, ImmutablePair<String, String>... params) {
    try {//from  www  .j  a v a2  s.c  o  m
        MessageFactory factory = MessageFactory.newInstance();
        SOAPMessage soapMessage = factory.createMessage();

        SOAPBodyElement actionElement = soapMessage.getSOAPBody().addBodyElement(new QName(null, action, "m"));
        actionElement.addNamespaceDeclaration("m", serviceType);

        for (Pair<String, String> param : params) {
            SOAPElement paramElement = actionElement.addChildElement(QName.valueOf(param.getKey()));
            paramElement.setValue(param.getValue());
        }

        soapMessage.getSOAPPart().setXmlStandalone(true);

        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        Transformer transformer = TransformerFactory.newInstance().newTransformer();
        transformer.setOutputProperty(OutputKeys.ENCODING, "UTF-8");
        transformer.transform(new DOMSource(soapMessage.getSOAPPart()), new StreamResult(baos));

        return baos.toByteArray();
    } catch (IllegalArgumentException | SOAPException | TransformerException | DOMException e) {
        throw new IllegalStateException(e); // should never happen
    }
}

From source file:com.offbynull.portmapper.upnpigd.UpnpIgdController.java

private Map<String, String> parseResponseXml(String expectedTagName, byte[] data) {
    try {/*from  w  ww.j  av a 2s  .c  o m*/
        MessageFactory factory = MessageFactory.newInstance();
        SOAPMessage soapMessage = factory.createMessage(new MimeHeaders(), new ByteArrayInputStream(data));

        if (soapMessage.getSOAPBody().hasFault()) {
            StringWriter writer = new StringWriter();
            try {
                Transformer transformer = TransformerFactory.newInstance().newTransformer();
                transformer.setOutputProperty(OutputKeys.ENCODING, "UTF-8");
                transformer.transform(new DOMSource(soapMessage.getSOAPPart()), new StreamResult(writer));
            } catch (IllegalArgumentException | TransformerException | TransformerFactoryConfigurationError e) {
                writer.append("Failed to dump fault: " + e);
            }

            throw new ResponseException(writer.toString());
        }

        Iterator<SOAPBodyElement> responseBlockIt = soapMessage.getSOAPBody()
                .getChildElements(new QName(serviceType, expectedTagName));
        if (!responseBlockIt.hasNext()) {
            throw new ResponseException(expectedTagName + " tag missing");
        }

        Map<String, String> ret = new HashMap<>();

        SOAPBodyElement responseNode = responseBlockIt.next();
        Iterator<SOAPBodyElement> responseChildrenIt = responseNode.getChildElements();
        while (responseChildrenIt.hasNext()) {
            SOAPBodyElement param = responseChildrenIt.next();
            String name = StringUtils.trim(param.getLocalName().trim());
            String value = StringUtils.trim(param.getValue().trim());

            ret.put(name, value);
        }

        return ret;
    } catch (IllegalArgumentException | IOException | SOAPException | DOMException e) {
        throw new IllegalStateException(e); // should never happen
    }
}

From source file:com.jaspersoft.ireport.designer.data.fieldsproviders.olap.OLAPQueryExecuter.java

/**
 * Parses the result-Message into this class's structure
 *
 * @param reply/* www.  j ava2 s  . c o m*/
 *            The reply-Message from the Server
 */
protected void parseResult(SOAPMessage reply) throws SOAPException, JRRuntimeException {
    SOAPPart soapPart = reply.getSOAPPart();
    SOAPEnvelope soapEnvelope = soapPart.getEnvelope();
    SOAPBody soapBody = soapEnvelope.getBody();
    SOAPElement eElement = null;

    if (log.isDebugEnabled()) {
        log.debug("XML/A result envelope: " + soapEnvelope.toString());
    }

    SOAPFault fault = soapBody.getFault();
    if (fault != null) {
        handleResultFault(fault);
    }

    Name eName = soapEnvelope.createName("ExecuteResponse", "", XMLA_URI);

    // Get the ExecuteResponse-Node
    Iterator responseElements = soapBody.getChildElements(eName);
    if (responseElements.hasNext()) {
        Object eObj = responseElements.next();
        if (eObj == null) {
            log.error("ExecuteResponse Element is null.");
            throw new JRRuntimeException("ExecuteResponse Element is null.");
        }
        eElement = (SOAPElement) eObj;
    } else {
        log.error("Could not retrieve ExecuteResponse Element.");
        throw new JRRuntimeException("Could not retrieve ExecuteResponse Element.");
    }

    // Get the return-Node
    Name rName = soapEnvelope.createName("return", "", XMLA_URI);
    Iterator returnElements = eElement.getChildElements(rName);
    SOAPElement returnElement = null;
    if (returnElements.hasNext()) {
        Object eObj = returnElements.next();
        if (eObj == null) {
            log.error("return Element is null.");
            throw new JRRuntimeException("return Element is null.");
        }
        returnElement = (SOAPElement) eObj;
    } else {
        // Should be old-Microsoft XMLA-SDK. Try without m-prefix
        Name rName2 = soapEnvelope.createName("return", "", "");
        returnElements = eElement.getChildElements(rName2);
        if (returnElements.hasNext()) {
            Object eObj = returnElements.next();
            if (eObj == null) {
                log.error("return Element is null.");
                throw new JRRuntimeException("return Element is null.");
            }
            returnElement = (SOAPElement) eObj;
        } else {
            log.error("Could not retrieve return Element.");
            throw new JRRuntimeException("Could not retrieve return Element.");
        }
    }

    // Get the root-Node
    Name rootName = soapEnvelope.createName("root", "", MDD_URI);
    SOAPElement rootElement = null;
    Iterator rootElements = returnElement.getChildElements(rootName);
    if (rootElements.hasNext()) {
        Object eObj = rootElements.next();
        if (eObj == null) {
            log.error("root Element is null.");
            throw new JRRuntimeException("root Element is null.");
        }
        rootElement = (SOAPElement) eObj;
    } else {
        log.error("Could not retrieve root Element.");
        throw new JRRuntimeException("Could not retrieve root Element.");
    }
    // Get the OlapInfo-Node
    Name olapInfoName = soapEnvelope.createName("OlapInfo", "", MDD_URI);
    SOAPElement olapInfoElement = null;
    Iterator olapInfoElements = rootElement.getChildElements(olapInfoName);
    if (olapInfoElements.hasNext()) {
        Object eObj = olapInfoElements.next();
        if (eObj == null) {
            log.error("OlapInfo Element is null.");
            throw new JRRuntimeException("OlapInfo Element is null.");
        }
        olapInfoElement = (SOAPElement) eObj;
    } else {
        log.error("Could not retrieve OlapInfo Element.");
        throw new JRRuntimeException("Could not retrieve OlapInfo Element.");
    }

    parseOLAPInfoElement(olapInfoElement);

    // Get the Axes Element
    Name axesName = soapEnvelope.createName("Axes", "", MDD_URI);
    SOAPElement axesElement = null;
    Iterator axesElements = rootElement.getChildElements(axesName);
    if (axesElements.hasNext()) {
        Object eObj = axesElements.next();
        if (eObj == null) {
            log.error("Axes Element is null");
            throw new JRRuntimeException("Axes Element is null");
        }
        axesElement = (SOAPElement) eObj;
    } else {
        log.error("Could not retrieve Axes Element.");
        throw new JRRuntimeException("Could not retrieve Axes Element.");
    }

    parseAxesElement(axesElement);

    // Get the CellData Element
    Name cellDataName = soapEnvelope.createName("CellData", "", MDD_URI);
    SOAPElement cellDataElement = null;
    Iterator cellDataElements = rootElement.getChildElements(cellDataName);
    if (cellDataElements.hasNext()) {
        Object eObj = cellDataElements.next();
        if (eObj == null) {
            log.error("CellData element is null");
            throw new JRRuntimeException("CellData element is null");
        }
        cellDataElement = (SOAPElement) eObj;
    } else {
        log.error("Could not retrieve CellData Element.");
        throw new JRRuntimeException("Could not retrieve CellData Element.");
    }
    parseCellDataElement(cellDataElement);
}