Example usage for javax.xml.soap SOAPElement getValue

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

Introduction

In this page you can find the example usage for javax.xml.soap SOAPElement 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.jaspersoft.ireport.designer.data.fieldsproviders.olap.OLAPQueryExecuter.java

protected void handleCellErrors(Iterator errorElems) throws SOAPException {
    SOAPElement errorElem = (SOAPElement) errorElems.next();

    StringBuffer errorMsg = new StringBuffer();
    errorMsg.append("Cell error: ");

    Iterator descriptionElems = errorElem.getChildElements(sf.createName("Description", "", MDD_URI));
    if (descriptionElems.hasNext()) {
        SOAPElement descrElem = (SOAPElement) descriptionElems.next();
        errorMsg.append(descrElem.getValue());
        errorMsg.append("; ");
    }/* ww  w  . j a v a  2s.  c  om*/

    Iterator sourceElems = errorElem.getChildElements(sf.createName("Source", "", MDD_URI));
    if (sourceElems.hasNext()) {
        SOAPElement sourceElem = (SOAPElement) sourceElems.next();
        errorMsg.append("Source: ");
        errorMsg.append(sourceElem.getValue());
        errorMsg.append("; ");
    }

    Iterator codeElems = errorElem.getChildElements(sf.createName("ErrorCode", "", MDD_URI));
    if (codeElems.hasNext()) {
        SOAPElement codeElem = (SOAPElement) codeElems.next();
        errorMsg.append("Code: ");
        errorMsg.append(codeElem.getValue());
        errorMsg.append("; ");
    }

    throw new JRRuntimeException(errorMsg.toString());
}

From source file:com.googlecode.ddom.frontend.saaj.SOAPElementTest.java

@Validated
@Test//from www  . j  a v a 2  s .  c  o  m
public void testGetValueMixedContent1() throws Exception {
    SOAPElement element = saajUtil.createSOAPElement(null, "test", null);
    element.addTextNode("foo");
    element.appendChild(element.getOwnerDocument().createElementNS("urn:ns", "p:child"));
    element.addTextNode("bar");
    assertEquals("foo", element.getValue());
}

From source file:com.googlecode.ddom.frontend.saaj.SOAPElementTest.java

@Validated
@Test/* w w  w .ja va2  s  . com*/
public void testGetValueMixedContent2() throws Exception {
    SOAPElement element = saajUtil.createSOAPElement(null, "test", null);
    element.appendChild(element.getOwnerDocument().createElementNS("urn:ns", "p:child1"));
    element.addTextNode("foo");
    element.appendChild(element.getOwnerDocument().createElementNS("urn:ns", "p:child2"));
    element.addTextNode("bar");
    assertEquals("foo", element.getValue());
}

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

protected void parseCellDataElement(SOAPElement cellDataElement) throws SOAPException {
    Name name = sf.createName("Cell", "", MDD_URI);
    Iterator itCells = cellDataElement.getChildElements(name);
    while (itCells.hasNext()) {
        SOAPElement cellElement = (SOAPElement) itCells.next();

        Name errorName = sf.createName("Error", "", MDD_URI);
        Iterator errorElems = cellElement.getChildElements(errorName);
        if (errorElems.hasNext()) {
            handleCellErrors(errorElems);
        }/* w  w  w  .j a  v  a2  s  .  com*/

        Name ordinalName = sf.createName("CellOrdinal");
        String cellOrdinal = cellElement.getAttributeValue(ordinalName);

        Object value = null;
        Iterator valueElements = cellElement.getChildElements(sf.createName("Value", "", MDD_URI));
        if (valueElements.hasNext()) {
            SOAPElement valueElement = (SOAPElement) valueElements.next();
            String valueType = valueElement.getAttribute("xsi:type");
            if (valueType.equals("xsd:int"))
                value = new Long(valueElement.getValue());
            else if (valueType.equals("xsd:double"))
                value = new Double(valueElement.getValue());
            else if (valueType.equals("xsd:decimal"))
                value = new Double(valueElement.getValue());
            else
                value = valueElement.getValue();
        }

        String fmtValue = "";
        Iterator fmtValueElements = cellElement.getChildElements(sf.createName("FmtValue", "", MDD_URI));
        if (fmtValueElements.hasNext()) {
            SOAPElement fmtValueElement = ((SOAPElement) fmtValueElements.next());
            fmtValue = fmtValueElement.getValue();
        }

        int pos = Integer.parseInt(cellOrdinal);
        JRXmlaCell cell = new JRXmlaCell(value, fmtValue);
        ((JRXmlaResult) xmlaResult).setCell(cell, pos);
    }
}

From source file:com.twinsoft.convertigo.engine.translators.WebServiceTranslator.java

public void buildInputDocument(Context context, Object inputData) throws Exception {
    Engine.logBeans.debug("[WebServiceTranslator] Making input document");

    HttpServletRequest request = (HttpServletRequest) inputData;

    SOAPMessage requestMessage = (SOAPMessage) request
            .getAttribute(WebServiceServlet.REQUEST_MESSAGE_ATTRIBUTE);

    SOAPPart sp = requestMessage.getSOAPPart();
    SOAPEnvelope se = sp.getEnvelope();
    SOAPBody sb = se.getBody();/*from   w ww  .  j  a v a  2 s .  com*/

    Iterator<?> iterator = sb.getChildElements();
    SOAPElement method, parameter;
    String methodName;

    InputDocumentBuilder inputDocumentBuilder = new InputDocumentBuilder(context);

    while (iterator.hasNext()) {
        List<RequestableVariable> variableList = null; // jmc 12/06/26

        Object element = iterator.next();
        if (element instanceof SOAPElement) {
            method = (SOAPElement) element;

            methodName = method.getElementName().getLocalName();
            Engine.logBeans.debug("[WebServiceTranslator] Requested web service name: " + methodName);

            int i = methodName.indexOf("__");

            // for statefull transaction, don't replace the project
            if (context.project == null || !context.project.getName().equals(context.projectName)) {
                context.project = Engine.theApp.databaseObjectsManager.getProjectByName(context.projectName);
            }

            String connectorName = null;
            if (i == -1) {
                context.connectorName = null;
                context.sequenceName = methodName;
            } else {
                connectorName = methodName.substring(0, i);
                context.transactionName = methodName.substring(i + 2);
            }

            if ((connectorName != null) && (!connectorName.equals(context.connectorName))) {
                Engine.logBeans.debug("Connector name differs from previous one; requiring new session");
                context.isNewSession = true;
                context.connectorName = connectorName;
                Engine.logBeans.debug("[WebServiceTranslator] The connector is overridden to \""
                        + context.connectorName + "\".");
            }

            Engine.logBeans.debug("[WebServiceTranslator] Connector: "
                    + (context.connectorName == null ? "(default)" : context.connectorName));
            Engine.logBeans.debug("[WebServiceTranslator] Transaction: " + context.transactionName);

            //Connector connector = (context.connectorName == null ? context.project.getDefaultConnector() : context.project.getConnectorByName(context.connectorName));
            //Transaction transaction = (context.transactionName == null ? connector.getDefaultTransaction() : connector.getTransactionByName(context.transactionName));
            RequestableObject requestable = null;
            if (context.sequenceName != null) {
                requestable = context.project.getSequenceByName(context.sequenceName);
                variableList = ((Sequence) requestable).getVariablesList();
            } else if (context.connectorName != null) {
                if (context.transactionName != null) {
                    requestable = context.project.getConnectorByName(context.connectorName)
                            .getTransactionByName(context.transactionName);
                    if (requestable instanceof TransactionWithVariables) {
                        variableList = ((TransactionWithVariables) requestable).getVariablesList();
                    }
                }
            }

            Iterator<?> iterator2 = method.getChildElements();
            String parameterName, parameterValue;

            while (iterator2.hasNext()) {
                element = iterator2.next();
                if (element instanceof SOAPElement) {
                    parameter = (SOAPElement) element;
                    parameterName = parameter.getElementName().getLocalName();
                    parameterValue = parameter.getValue();
                    if (parameterValue == null) {
                        parameterValue = "";
                    }

                    if (variableList != null) { // jmc 12/06/26 hide hidden variables in sequences
                        String str = (String) Visibility.Logs.replaceVariables(variableList,
                                "" + parameterName + "=\"" + parameterValue + "\"");
                        Engine.logBeans.debug("   Parameter: " + str);
                    } else
                        Engine.logBeans.debug("   Parameter: " + parameterName + "=\"" + parameterValue + "\"");

                    // Handle convertigo parameters
                    if (parameterName.startsWith("__")) {
                        webServiceServletRequester.handleParameter(parameterName, parameterValue);
                    }

                    // Common parameter handling
                    if (inputDocumentBuilder.handleSpecialParameter(parameterName, parameterValue)) {
                        // handled
                    }
                    // Compatibility for Convertigo 2.x
                    else if (parameterName.equals("context")) {
                        // Just ignore it
                    } else {
                        SOAPElement soapArrayElement = null;
                        Iterator<?> iterator3;

                        String href = parameter.getAttributeValue(se.createName("href"));

                        String arrayType = parameter.getAttributeValue(se.createName("soapenc:arrayType"));
                        if (arrayType == null) {
                            iterator3 = parameter.getAllAttributes();
                            while (iterator3.hasNext()) {
                                element = iterator3.next();
                                if (element instanceof Name) {
                                    String s = ((Name) element).getQualifiedName();
                                    if (s.equals("soapenc:arrayType")) {
                                        arrayType = s;
                                        break;
                                    }
                                }
                            }
                        }

                        // Array (Microsoft .net)
                        if (href != null) {
                            Engine.logBeans.debug("Deserializing Microsoft .net array");
                            iterator3 = sb.getChildElements();
                            while (iterator3.hasNext()) {
                                element = iterator3.next();
                                if (element instanceof SOAPElement) {
                                    soapArrayElement = (SOAPElement) element;
                                    String elementId = soapArrayElement.getAttributeValue(se.createName("id"));
                                    if (elementId != null) {
                                        if (href.equals("#" + elementId)) {
                                            iterator3 = soapArrayElement.getChildElements();
                                            while (iterator3.hasNext()) {
                                                element = iterator3.next();
                                                if (element instanceof SOAPElement) {
                                                    break;
                                                }
                                            }
                                            break;
                                        }
                                    }
                                }
                            }

                            // Find the element with href id
                            iterator3 = sb.getChildElements();
                            while (iterator3.hasNext()) {
                                element = iterator3.next();
                                if (element instanceof SOAPElement) {
                                    soapArrayElement = (SOAPElement) element;
                                    String elementId = soapArrayElement.getAttributeValue(se.createName("id"));
                                    if (elementId != null) {
                                        if (href.equals("#" + elementId)) {
                                            break;
                                        }
                                    }
                                }
                            }
                        }
                        // Array (Java/Axis)
                        else if (arrayType != null) {
                            Engine.logBeans.debug("Deserializing Java/Axis array");
                            soapArrayElement = parameter;
                        }
                        // If the node has children nodes, we assume it is an array.
                        else if (parameter.getChildElements().hasNext()) {
                            if (isSoapArray((IVariableContainer) requestable, parameterName)) {
                                Engine.logBeans.debug("Deserializing array");
                                soapArrayElement = parameter;
                            }
                        }

                        // Deserializing array
                        if (soapArrayElement != null) {
                            iterator3 = soapArrayElement.getChildElements();
                            while (iterator3.hasNext()) {
                                element = iterator3.next();
                                if (element instanceof SOAPElement) {
                                    soapArrayElement = (SOAPElement) element;
                                    parameterValue = soapArrayElement.getValue();
                                    if (parameterValue == null)
                                        parameterValue = "";
                                    handleSimpleVariable(context.inputDocument, soapArrayElement, parameterName,
                                            parameterValue, inputDocumentBuilder.transactionVariablesElement);
                                }
                            }
                        }
                        // Deserializing simple variable
                        else {
                            handleSimpleVariable(context.inputDocument, parameter, parameterName,
                                    parameterValue, inputDocumentBuilder.transactionVariablesElement);
                        }
                    }
                }
            }

            if (Engine.logBeans.isDebugEnabled()) {
                String soapMessage = SOAPUtils.toString(requestMessage, request.getCharacterEncoding());

                if (requestable instanceof TransactionWithVariables)
                    Engine.logBeans.debug("[WebServiceTranslator] SOAP message received:\n"
                            + Visibility.Logs.replaceVariables(
                                    ((TransactionWithVariables) (requestable)).getVariablesList(), request));
                else if (requestable instanceof Sequence)
                    Engine.logBeans.debug("[WebServiceTranslator] SOAP message received:\n" + Visibility.Logs
                            .replaceVariables(((Sequence) (requestable)).getVariablesList(), request));
                else
                    Engine.logBeans.debug("[WebServiceTranslator] SOAP message received:\n" + soapMessage);
            }

            break;
        }
    }

    Engine.logBeans.debug("[WebServiceTranslator] SOAP message analyzed");

    Engine.logBeans.debug("[WebServiceTranslator] Input document created");
}

From source file:org.jbpm.bpel.integration.soap.SoapUtilTest.java

public void testCopy_soapDom_qualifiedNoPrefix() throws Exception {
    String xml = "<ReverseAndConcatNames xmlns='http://my.namespace'>" + " <firstName>Martin</firstName>"
            + " <secondName>Steinle</secondName>" + "</ReverseAndConcatNames>";
    Element source = XmlUtil.parseText(xml);

    SOAPMessage soapMessage = MessageFactory.newInstance().createMessage();
    SOAPEnvelope envelope = soapMessage.getSOAPPart().getEnvelope();
    SOAPElement target = envelope.getBody().addBodyElement(envelope.createName("detail"));

    // perform the copy
    SoapUtil.copy(target, source);//from  w w w  .  j  a  v  a  2s.c  om

    assertEquals("http://my.namespace", target.getNamespaceURI(SoapUtil.DEFAULT_NAMESPACE_PREFIX));
    // qualified elements
    SOAPElement firstName = SoapUtil.getElement(target, "http://my.namespace", "firstName");
    assertEquals("Martin", firstName.getValue());
    SOAPElement secondName = SoapUtil.getElement(target, "http://my.namespace", "secondName");
    assertEquals("Steinle", secondName.getValue());
}

From source file:org.pentaho.platform.plugin.action.xmla.XMLABaseComponent.java

/**
 * Execute query//from   ww w . j av a 2 s.c om
 *
 * @param query   - MDX to be executed
 * @param catalog
 * @param handler Callback handler
 * @throws XMLAException
 */
public boolean executeQuery(final String query, final String catalog) throws XMLAException {

    Object[][] columnHeaders = null;
    Object[][] rowHeaders = null;
    Object[][] data = null;

    int columnCount = 0;
    int rowCount = 0;

    SOAPConnection connection = null;
    SOAPMessage reply = null;

    try {
        connection = scf.createConnection();
        SOAPMessage msg = mf.createMessage();

        MimeHeaders mh = msg.getMimeHeaders();
        mh.setHeader("SOAPAction", XMLABaseComponent.EXECUTE_ACTION); //$NON-NLS-1$

        SOAPPart soapPart = msg.getSOAPPart();
        SOAPEnvelope envelope = soapPart.getEnvelope();
        envelope.setEncodingStyle(XMLABaseComponent.ENCODING_STYLE);

        SOAPBody body = envelope.getBody();
        Name nEx = envelope.createName("Execute", "", XMLABaseComponent.XMLA_URI); //$NON-NLS-1$//$NON-NLS-2$

        SOAPElement eEx = body.addChildElement(nEx);
        eEx.setEncodingStyle(XMLABaseComponent.ENCODING_STYLE);

        // add the parameters

        // COMMAND parameter
        // <Command>
        // <Statement>select [Measures].members on Columns from
        // Sales</Statement>
        // </Command>
        Name nCom = envelope.createName("Command", "", XMLABaseComponent.XMLA_URI); //$NON-NLS-1$ //$NON-NLS-2$
        SOAPElement eCommand = eEx.addChildElement(nCom);
        Name nSta = envelope.createName("Statement", "", XMLABaseComponent.XMLA_URI); //$NON-NLS-1$ //$NON-NLS-2$
        SOAPElement eStatement = eCommand.addChildElement(nSta);
        eStatement.addTextNode(query);

        // <Properties>
        // <PropertyList>
        // <DataSourceInfo>Provider=MSOLAP;Data
        // Source=local</DataSourceInfo>
        // <Catalog>Foodmart 2000</Catalog>
        // <Format>Multidimensional</Format>
        // <AxisFormat>TupleFormat</AxisFormat> oder "ClusterFormat"
        // </PropertyList>
        // </Properties>
        Map paraList = new HashMap();
        paraList.put("DataSourceInfo", dataSource); //$NON-NLS-1$
        paraList.put("Catalog", catalog); //$NON-NLS-1$
        paraList.put("Format", "Multidimensional"); //$NON-NLS-1$ //$NON-NLS-2$
        paraList.put("AxisFormat", "TupleFormat"); //$NON-NLS-1$ //$NON-NLS-2$
        addParameterList(envelope, eEx, "Properties", "PropertyList", paraList); //$NON-NLS-1$ //$NON-NLS-2$

        msg.saveChanges();

        debug("Request for Execute"); //$NON-NLS-1$
        logSoapMsg(msg);

        // run the call
        reply = connection.call(msg, url);

        debug("Reply from Execute"); //$NON-NLS-1$
        logSoapMsg(reply);

        // error check
        errorCheck(reply);

        // process the reply
        SOAPElement eRoot = findExecRoot(reply);

        // for each axis, get the positions (tuples)
        Name name = envelope.createName("Axes", "", XMLABaseComponent.MDD_URI); //$NON-NLS-1$ //$NON-NLS-2$
        SOAPElement eAxes = selectSingleNode(eRoot, name);
        if (eAxes == null) {
            throw new XMLAException("Excecute result has no Axes element"); //$NON-NLS-1$
        }

        name = envelope.createName("Axis", "", XMLABaseComponent.MDD_URI); //$NON-NLS-1$ //$NON-NLS-2$
        Iterator itAxis = eAxes.getChildElements(name);

        AxisLoop: for (int iOrdinal = 0; itAxis.hasNext();) {
            SOAPElement eAxis = (SOAPElement) itAxis.next();
            name = envelope.createName("name"); //$NON-NLS-1$
            String axisName = eAxis.getAttributeValue(name);
            int axisOrdinal;
            if (axisName.equals("SlicerAxis")) { //$NON-NLS-1$
                continue;
            } else {
                axisOrdinal = iOrdinal++;
            }

            name = envelope.createName("Tuples", "", XMLABaseComponent.MDD_URI); //$NON-NLS-1$//$NON-NLS-2$
            SOAPElement eTuples = selectSingleNode(eAxis, name);
            if (eTuples == null) {
                continue AxisLoop; // what else?
            }

            name = envelope.createName("Tuple", "", XMLABaseComponent.MDD_URI); //$NON-NLS-1$//$NON-NLS-2$
            Iterator itTuple = eTuples.getChildElements(name);

            // loop over tuples
            int positionOrdinal = 0;
            while (itTuple.hasNext()) { // TupleLoop

                SOAPElement eTuple = (SOAPElement) itTuple.next();

                if ((axisOrdinal == XMLABaseComponent.AXIS_COLUMNS) && (columnHeaders == null)) {
                    columnCount = getChildCount(envelope, eTuples, "Tuple"); //$NON-NLS-1$
                    columnHeaders = new Object[getChildCount(envelope, eTuple, "Member")][columnCount]; //$NON-NLS-1$
                } else if ((axisOrdinal == XMLABaseComponent.AXIS_ROWS) && (rowHeaders == null)) {
                    rowCount = getChildCount(envelope, eTuples, "Tuple"); //$NON-NLS-1$
                    rowHeaders = new Object[rowCount][getChildCount(envelope, eTuple, "Member")]; //$NON-NLS-1$
                }

                int index = 0;
                name = envelope.createName("Member", "", XMLABaseComponent.MDD_URI); //$NON-NLS-1$//$NON-NLS-2$
                Iterator itMember = eTuple.getChildElements(name);
                while (itMember.hasNext()) { // MemberLoop
                    SOAPElement eMem = (SOAPElement) itMember.next();
                    // loop over children nodes
                    String caption = null;
                    Iterator it = eMem.getChildElements();
                    InnerLoop: while (it.hasNext()) {
                        Node n = (Node) it.next();
                        if (!(n instanceof SOAPElement)) {
                            continue InnerLoop;
                        }
                        SOAPElement el = (SOAPElement) n;
                        String enam = el.getElementName().getLocalName();
                        if (enam.equals("Caption")) { //$NON-NLS-1$
                            caption = el.getValue();
                        }
                    }
                    if (axisOrdinal == XMLABaseComponent.AXIS_COLUMNS) {
                        columnHeaders[index][positionOrdinal] = caption;
                    } else if (axisOrdinal == XMLABaseComponent.AXIS_ROWS) {
                        rowHeaders[positionOrdinal][index] = caption;
                    }
                    ++index;
                } // MemberLoop

                ++positionOrdinal;
            } // TupleLoop
        } // AxisLoop

        data = new Object[rowCount][columnCount];
        // loop over cells in result set
        name = envelope.createName("CellData", "", XMLABaseComponent.MDD_URI); //$NON-NLS-1$//$NON-NLS-2$
        SOAPElement eCellData = selectSingleNode(eRoot, name);
        name = envelope.createName("Cell", "", XMLABaseComponent.MDD_URI); //$NON-NLS-1$//$NON-NLS-2$
        Iterator itSoapCell = eCellData.getChildElements(name);
        while (itSoapCell.hasNext()) { // CellLoop
            SOAPElement eCell = (SOAPElement) itSoapCell.next();
            name = envelope.createName("CellOrdinal", "", ""); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
            String cellOrdinal = eCell.getAttributeValue(name);
            int ordinal = Integer.parseInt(cellOrdinal);
            name = envelope.createName("Value", "", XMLABaseComponent.MDD_URI); //$NON-NLS-1$//$NON-NLS-2$
            Object value = selectSingleNode(eCell, name).getValue();

            int rowLoc = ordinal / columnCount;
            int columnLoc = ordinal % columnCount;

            data[rowLoc][columnLoc] = value;
        } // CellLoop

        MemoryResultSet resultSet = new MemoryResultSet();
        MemoryMetaData metaData = new MemoryMetaData(columnHeaders, rowHeaders);
        resultSet.setMetaData(metaData);
        for (Object[] element : data) {
            resultSet.addRow(element);
        }
        rSet = resultSet;
        if (resultSet != null) {
            if (getResultOutputName() != null) {
                setOutputValue(getResultOutputName(), resultSet);
            }
            return true;
        }
        return false;

    } catch (SOAPException se) {
        throw new XMLAException(se);
    } finally {
        if (connection != null) {
            try {
                connection.close();
            } catch (SOAPException e) {
                // log and ignore
                error("?", e); //$NON-NLS-1$
            }
        }

    }

}

From source file:org.pentaho.platform.plugin.action.xmla.XMLABaseComponent.java

/**
 * retrieve data source properties//from w w  w . jav a2  s. c  o  m
 *
 * @return Map of key/value strings
 * @see DataSourceBrowser
 */
public Map discoverDS() throws XMLAException {
    // Microsoft wants restrictions
    HashMap rHash = new HashMap();

    HashMap pHash = new HashMap();
    pHash.put("Content", "Data"); //$NON-NLS-1$ //$NON-NLS-2$
    final Map resultMap = new HashMap();
    Rowhandler rh = new Rowhandler() {

        public void handleRow(SOAPElement eRow, SOAPEnvelope envelope) {

            /*
             * <row><DataSourceName>SAP_BW</DataSourceName> <DataSourceDescription>SAP BW Release 3.0A XML f. Analysis
             * Service</DataSourceDescription> <URL>http://155.56.49.46:83/SAP/BW/XML/SOAP/XMLA</URL>
             * <DataSourceInfo>default</DataSourceInfo> <ProviderName>SAP BW</ProviderName> <ProviderType>MDP</ProviderType>
             * <AuthenticationMode>Integrated</AuthenticationMode></row>
             */
            Iterator it = eRow.getChildElements();
            while (it.hasNext()) {
                Object o = it.next();
                if (!(o instanceof SOAPElement)) {
                    continue; // bypass text nodes
                }
                SOAPElement e = (SOAPElement) o;
                String name = e.getElementName().getLocalName();
                String value = e.getValue();
                resultMap.put(name, value);
            }
        }
    };

    discover("DISCOVER_DATASOURCES", url, rHash, pHash, rh); //$NON-NLS-1$
    debug(Messages.getInstance().getString("XMLABaseComponent.DEBUG_0005_DISCOVER_DATASOURCE_FOUND")
            + resultMap.size()); //$NON-NLS-1$
    return resultMap;

}

From source file:org.pentaho.platform.plugin.action.xmla.XMLABaseComponent.java

/**
 * Find the Provider type in the DiscoverResponse
 *
 * @param n//from   w  ww . j a  va 2s .  c  om
 * @return
 * @throws XMLAException
 * @throws SOAPException
 */
private int getProviderFromDiscoverResponse(final SOAPEnvelope envelope, final SOAPElement e)
        throws XMLAException, SOAPException {
    Name name = e.getElementName();
    if (!name.getLocalName().equals("DiscoverResponse")) { //$NON-NLS-1$
        throw new XMLAException(
                Messages.getInstance().getString("XMLABaseComponent.ERROR_0018_NOT_A_DISCOVER_RESPONSE") //$NON-NLS-1$
                        + name.getLocalName());
    }

    // Look for return/root/row/ProviderName

    SOAPElement walker = getDiscoverReturn(envelope, e);

    if (walker == null) {
        throw new XMLAException(
                Messages.getInstance().getString("XMLABaseComponent.ERROR_0019_NO_RESULT_DISCOVER_RESPONSE")); //$NON-NLS-1$
    }

    walker = getDiscoverRoot(envelope, walker);

    if (walker == null) {
        throw new XMLAException(Messages.getInstance()
                .getString("XMLABaseComponent.ERROR_0020_NO_RESULT_DISCOVER_RETURN_ROOT")); //$NON-NLS-1$
    }

    walker = getDiscoverRow(envelope, walker);

    if (walker == null) {
        throw new XMLAException(
                Messages.getInstance().getString("XMLABaseComponent.ERROR_0021_NO_DISCOVER_RESPONSE_ROW")); //$NON-NLS-1$
    }

    /*
     * Name nProviderName = envelope.createName("ProviderName", "", ROWS_URI); SOAPElement eProviderName =
     * selectSingleNode(e, nProviderName);
     * 
     * if (eProviderName == null) { throw new OlapException("Discover result has no
     * DiscoverResponse/return/root/row/ProviderName element"); } value = eProviderName.getValue();
     */
    String value = null;
    Iterator it = walker.getChildElements();
    while (it.hasNext()) {
        Object o = it.next();
        if (!(o instanceof SOAPElement)) {
            continue; // bypass text nodes
        }
        SOAPElement e2 = (SOAPElement) o;
        String nameString = e2.getElementName().getLocalName();
        if (nameString.equals("ProviderName")) { //$NON-NLS-1$
            value = e2.getValue();
            debug(Messages.getInstance().getString("XMLABaseComponent.DEBUG_0008_FOUND_PROVIDER") + value); //$NON-NLS-1$
            break;
        }
    }

    if ((value == null) || (value.trim().length() == 0)) {
        throw new XMLAException(
                Messages.getInstance().getString("XMLABaseComponent.ERROR_0022_NO_PROVIDER_NAME_ELEMENT")); //$NON-NLS-1$
    }

    return determineProvider("Provider=" + value); //$NON-NLS-1$
}