Package org.dom4j

Examples of org.dom4j.XPath.selectNodes()


    }

    public Document dispatchResponse(Document response) throws InvalidInputFormatException {
      XPath xpath = DocumentHelper.createXPath("/soapenv:Envelope/soapenv:Body/soapenv:Fault");
      xpath.setNamespaceURIs(MessageConstants.get_nsMap());
        List fault = xpath.selectNodes(response);
        if(fault.size() != 0) {
            // return fault as-is
            LOG.error("Fault response during notify:\n"+response.asXML());
            return response;
        }
View Full Code Here


         * Now, change the namespace of all soapenv:Body elements, except the
         * task input and the attachments, to ib4p.
         */
        xpath = DocumentHelper.createXPath("//" + REQUEST_PREFIX + ":taskInput//*");
        xpath.setNamespaceURIs(namespaceURIs/* MessageConstants.get_nsMap() */);
        List<Node> allTaskInputElements = xpath.selectNodes(message);
        xpath = DocumentHelper.createXPath("//" + REQUEST_PREFIX + ":attachments//*");
        xpath.setNamespaceURIs(namespaceURIs/* MessageConstants.get_nsMap() */);
        List<Node> allAttachmentsElements = xpath.selectNodes(message);
        for (int i = 0; i < allSoapBodyElements.size(); ++i) {
            Node node = (Node) allSoapBodyElements.get(i);
View Full Code Here

        xpath = DocumentHelper.createXPath("//" + REQUEST_PREFIX + ":taskInput//*");
        xpath.setNamespaceURIs(namespaceURIs/* MessageConstants.get_nsMap() */);
        List<Node> allTaskInputElements = xpath.selectNodes(message);
        xpath = DocumentHelper.createXPath("//" + REQUEST_PREFIX + ":attachments//*");
        xpath.setNamespaceURIs(namespaceURIs/* MessageConstants.get_nsMap() */);
        List<Node> allAttachmentsElements = xpath.selectNodes(message);
        for (int i = 0; i < allSoapBodyElements.size(); ++i) {
            Node node = (Node) allSoapBodyElements.get(i);
            if (!allTaskInputElements.contains(node) && !allAttachmentsElements.contains(node)) {

                Element element = (Element) node;
View Full Code Here

    @SuppressWarnings("unchecked")
    public void convertMessage(Document message, String userProcessNamespaceUri)
            throws MessageFormatException {
      XPath xpathSelector = DocumentHelper.createXPath("/soapenv:Envelope/soapenv:Body/soapenv:Fault");
      xpathSelector.setNamespaceURIs(MessageConstants.get_nsMap());
      List<Node> fault = xpathSelector.selectNodes(message);
        if(fault.size() != 0) {
            // return fault as-is
            LOG.error("Fault in response:\n"+message.asXML());
            return;
        }
View Full Code Here

        }
               
        //retrieve session
        xpathSelector = DocumentHelper.createXPath("/soapenv:Envelope/soapenv:Body/*[1]/ib4p:taskMetaData/ib4p:session");
        xpathSelector.setNamespaceURIs(MessageConstants.get_nsMap());
        List<Node> sessionNodes = xpathSelector.selectNodes(message);
        if (sessionNodes.size() > 0) {
            Element sessionElement = (Element) sessionNodes.get(0);
            String session = sessionElement.getText();
           
            //remove callback
View Full Code Here

            String session = sessionElement.getText();
           
            //remove callback
            xpathSelector = DocumentHelper.createXPath("/soapenv:Envelope/soapenv:Header/intalio:callback");
            xpathSelector.setNamespaceURIs(MessageConstants.get_nsMap());
            List<Node> callbackNodes = xpathSelector.selectNodes(message);
            if (callbackNodes.size() != 0) {
                Element wsaTo = (Element) callbackNodes.get(0);
                Element header = (Element)wsaTo.getParent();
                header.remove(wsaTo);
                sessionElement = header.addElement("session", MessageConstants.INTALIO_NS);
View Full Code Here

        }

        /* fetch the user process endpoint element from the task metadata */
        xpathSelector = DocumentHelper.createXPath("/soapenv:Envelope/soapenv:Body/*[1]/ib4p:taskMetaData/ib4p:userProcessEndpoint");
        xpathSelector.setNamespaceURIs(MessageConstants.get_nsMap());
        List<Node> userProcessEndpointNodes = xpathSelector.selectNodes(message);
        if (userProcessEndpointNodes.size() > 0) {
            /* found the user process endpoint element */
            Element userProcessEndpointElement = (Element) userProcessEndpointNodes.get(0);
            /* save it for later use */
            _userProcessEndpoint = userProcessEndpointElement.getText();
View Full Code Here

            _userProcessEndpoint = userProcessEndpointElement.getText();

            /* do we have a wsa:To element? */
            xpathSelector = DocumentHelper.createXPath("//wsa:To");
            xpathSelector.setNamespaceURIs(MessageConstants.get_nsMap());
            List<Node> wsaToNodes = xpathSelector.selectNodes(message);
            if (wsaToNodes.size() != 0) {
                /* We have the wsa:To element. Set the correct target endpoint */
                Element wsaTo = (Element) wsaToNodes.get(0);
                wsaTo.setText(_userProcessEndpoint);
            }
View Full Code Here

            }

            /* do we have a addr:To element? */
            xpathSelector = DocumentHelper.createXPath("//addr:To");
            xpathSelector.setNamespaceURIs(MessageConstants.get_nsMap());
            List<Node> addrToNodes = xpathSelector.selectNodes(message);
            if (addrToNodes.size() != 0) {
                /* We have the wsa:To element. Set the correct target endpoint */
                Element wsaTo = (Element) addrToNodes.get(0);
                //wsaTo.removeChildren();
                wsaTo.setText(_userProcessEndpoint);
View Full Code Here

         * section.
         */
        if (userProcessNamespaceUri == null) {
          xpathSelector = DocumentHelper.createXPath("/soapenv:Envelope/soapenv:Body/*[1]/ib4p:taskMetaData/ib4p:userProcessNamespaceURI");
          xpathSelector.setNamespaceURIs(MessageConstants.get_nsMap());
            List<Node> namespaceElementQueryResult = xpathSelector.selectNodes(message);
            if (namespaceElementQueryResult.size() == 0) {
                throw new MessageFormatException("No user process namespace specified "
                        + "and no ib4p:userProcessNamespaceURI element present to determine those.");
            }
            Element userProcessNamespaceUriElement = (Element) namespaceElementQueryResult.get(0);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.