List of usage examples for javax.xml.soap SOAPEnvelope toString
public String toString()
From source file:com.jaspersoft.ireport.designer.data.fieldsproviders.olap.OLAPQueryExecuter.java
/** * Parses the result-Message into this class's structure * * @param reply/* ww w. ja v a2 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); }