Examples of XPathUtils


Examples of org.apache.cxf.helpers.XPathUtils

        Document doc = StaxUtils.read(new StringReader(s));
       
        Map<String, String> ns = new HashMap<String, String>();
        ns.put("wsa", "http://www.w3.org/2005/08/addressing");
        ns.put("soap", "http://schemas.xmlsoap.org/soap/envelope/");
        XPathUtils xpathu = new XPathUtils(ns);
        return xpathu.getValueString(xpath, doc.getDocumentElement());
    }
View Full Code Here

Examples of org.apache.cxf.helpers.XPathUtils

        Document doc = StaxUtils.read(new StringReader(s));
       
        Map<String, String> ns = new HashMap<String, String>();
        ns.put("wsa", "http://www.w3.org/2005/08/addressing");
        ns.put("soap", "http://schemas.xmlsoap.org/soap/envelope/");
        XPathUtils xpathu = new XPathUtils(ns);
        assertNull(xpathu.getValueNode(xpath, doc.getDocumentElement()));
    }
View Full Code Here

Examples of org.apache.cxf.helpers.XPathUtils

                throw new RuntimeException(e);
            }
           
            Map<String, String> ns = new HashMap<String, String>();
            ns.put("ns", "http://apache.org/cxf/systest/ws/addr_feature/");
            XPathUtils xp = new XPathUtils(ns);
            String o = (String)xp.getValue("/ns:addNumbers/ns:number1", el, XPathConstants.STRING);
            String o2 = (String)xp.getValue("/ns:addNumbers/ns:number2", el, XPathConstants.STRING);
            int i = Integer.parseInt(o);
            int i2 = Integer.parseInt(o2);
           
            String resp = "<addNumbersResponse xmlns=\"http://apache.org/cxf/systest/ws/addr_feature/\">"
                + "<return>" + (i + i2) + "</return></addNumbersResponse>";
View Full Code Here

Examples of org.apache.cxf.helpers.XPathUtils

            } catch (Exception e) {
                throw new RuntimeException(e);
            }
            Map<String, String> ns = new HashMap<String, String>();
            ns.put("ns", "http://apache.org/cxf/systest/ws/addr_feature/");
            XPathUtils xp = new XPathUtils(ns);
            String o = (String)xp.getValue("/ns:addNumbers/ns:number1", el, XPathConstants.STRING);
            String o2 = (String)xp.getValue("/ns:addNumbers/ns:number2", el, XPathConstants.STRING);
            int i = Integer.parseInt(o);
            int i2 = Integer.parseInt(o2);
           
           
            ctx.getMessageContext()
View Full Code Here

Examples of org.apache.cxf.helpers.XPathUtils

        assertNotNull(doc);
       
        Map<String, String> ns = new HashMap<String, String>();
        ns.put("soap", Soap11.SOAP_NAMESPACE);
        ns.put("ns2", "http://apache.org/hello_world_soap_http/types");
        XPathUtils xu = new XPathUtils(ns);
        Node body = (Node) xu.getValue("/soap:Envelope/soap:Body", doc, XPathConstants.NODE);
        assertNotNull(body);
        String response = (String) xu.getValue("//ns2:sayHiResponse/ns2:responseType/text()",
                                               body,
                                               XPathConstants.STRING);
        assertEquals("Bonjour", response);
    }
View Full Code Here

Examples of org.apache.cxf.helpers.XPathUtils

        assertNotNull(doc);
       
        Map<String, String> ns = new HashMap<String, String>();
        ns.put("soap", Soap11.SOAP_NAMESPACE);
        ns.put("ns2", "http://apache.org/hello_world_soap_http/types");
        XPathUtils xu = new XPathUtils(ns);
        Node body = (Node) xu.getValue("/soap:Envelope/soap:Body", doc, XPathConstants.NODE);
        assertNotNull(body);
        String response = (String) xu.getValue("//ns2:greetMeResponse/ns2:responseType/text()",
                                               body,
                                               XPathConstants.STRING);
        assertEquals("Hello cxf", response);
    }
View Full Code Here

Examples of org.apache.cxf.helpers.XPathUtils

        assertNotNull(doc);
       
        Map<String, String> ns = new HashMap<String, String>();
        ns.put("soap", Soap11.SOAP_NAMESPACE);
        ns.put("ns2", "http://apache.org/hello_world_soap_http/types");
        XPathUtils xu = new XPathUtils(ns);
        Node body = (Node) xu.getValue("/soap:Envelope/soap:Body", doc, XPathConstants.NODE);
        assertNotNull(body);
        String response = (String) xu.getValue("//ns2:greetMeResponse/ns2:responseType/text()",
                                               body,
                                               XPathConstants.STRING);
        assertEquals("Hello cxf (was CeltixFire)", response);
    }
View Full Code Here

Examples of org.apache.cxf.helpers.XPathUtils

    }
    @Test
    public void testWSDLDocs() throws Exception {
        Map<String, String> ns = new HashMap<String, String>();
        ns.put("wsdl", WSDLConstants.NS_WSDL11);
        XPathUtils xpu = new XPathUtils(ns);
        Document wsdl = XMLUtils.parse(this.getHttpConnection(ServerMisc.DOCLIT_CODEFIRST_URL + "?wsdl")
                                          .getInputStream());
        //XMLUtils.printDOM(wsdl.getDocumentElement());
        assertEquals("DocLitWrappedCodeFirstService impl",
                     xpu.getValue("/wsdl:definitions/wsdl:service/wsdl:documentation",
                                  wsdl.getDocumentElement(),
                                  XPathConstants.STRING));
        assertEquals("DocLitWrappedCodeFirstService interface",
                     xpu.getValue("/wsdl:definitions/wsdl:portType/wsdl:documentation",
                                  wsdl.getDocumentElement(),
                                  XPathConstants.STRING));
        assertEquals("DocLitWrappedCodeFirstService top level doc",
                     xpu.getValue("/wsdl:definitions/wsdl:documentation",
                                  wsdl.getDocumentElement(),
                                  XPathConstants.STRING));
        assertEquals("DocLitWrappedCodeFirstService binding doc",
                     xpu.getValue("/wsdl:definitions/wsdl:binding/wsdl:documentation",
                                  wsdl.getDocumentElement(),
                                  XPathConstants.STRING));
        assertEquals("DocLitWrappedCodeFirstService service/port doc",
                     xpu.getValue("/wsdl:definitions/wsdl:service/wsdl:port/wsdl:documentation",
                                  wsdl.getDocumentElement(),
                                  XPathConstants.STRING));
        assertEquals("multiInOut doc",
                     xpu.getValue("/wsdl:definitions/wsdl:portType/wsdl:operation[@name='multiInOut']"
                                  + "/wsdl:documentation",
                                  wsdl.getDocumentElement(),
                                  XPathConstants.STRING));
        assertEquals("multiInOut Input doc",
                     xpu.getValue("/wsdl:definitions/wsdl:portType/wsdl:operation[@name='multiInOut']"
                                  + "/wsdl:input/wsdl:documentation",
                                  wsdl.getDocumentElement(),
                                  XPathConstants.STRING));
        assertEquals("multiInOut Output doc",
                     xpu.getValue("/wsdl:definitions/wsdl:portType/wsdl:operation[@name='multiInOut']"
                                  + "/wsdl:output/wsdl:documentation",
                                  wsdl.getDocumentElement(),
                                  XPathConstants.STRING));
        assertEquals("multiInOut InputMessage doc",
                     xpu.getValue("/wsdl:definitions/wsdl:message[@name='multiInOut']"
                                  + "/wsdl:documentation",
                                  wsdl.getDocumentElement(),
                                  XPathConstants.STRING));
        assertEquals("multiInOut OutputMessage doc",
                     xpu.getValue("/wsdl:definitions/wsdl:message[@name='multiInOutResponse']"
                                  + "/wsdl:documentation",
                                  wsdl.getDocumentElement(),
                                  XPathConstants.STRING));
        assertEquals("multiInOut binding doc",
                     xpu.getValue("/wsdl:definitions/wsdl:binding/wsdl:operation[@name='multiInOut']"
                                  + "/wsdl:documentation",
                                  wsdl.getDocumentElement(),
                                  XPathConstants.STRING));
        assertEquals("multiInOut binding Input doc",
                     xpu.getValue("/wsdl:definitions/wsdl:binding/wsdl:operation[@name='multiInOut']"
                                  + "/wsdl:input/wsdl:documentation",
                                  wsdl.getDocumentElement(),
                                  XPathConstants.STRING));
        assertEquals("multiInOut binding Output doc",
                     xpu.getValue("/wsdl:definitions/wsdl:binding/wsdl:operation[@name='multiInOut']"
                                  + "/wsdl:output/wsdl:documentation",
                                  wsdl.getDocumentElement(),
                                  XPathConstants.STRING));
        assertEquals("fault binding doc",
                     xpu.getValue("/wsdl:definitions/wsdl:binding/wsdl:operation[@name='throwException']"
                                  + "/wsdl:fault/wsdl:documentation",
                                  wsdl.getDocumentElement(),
                                  XPathConstants.STRING));
        assertEquals("fault porttype doc",
                     xpu.getValue("/wsdl:definitions/wsdl:portType/wsdl:operation[@name='throwException']"
                                  + "/wsdl:fault/wsdl:documentation",
                                  wsdl.getDocumentElement(),
                                  XPathConstants.STRING));
        assertEquals("fault message doc",
                     xpu.getValue("/wsdl:definitions/wsdl:message[@name='CustomException']"
                                  + "/wsdl:documentation",
                                  wsdl.getDocumentElement(),
                                  XPathConstants.STRING));
    }
View Full Code Here

Examples of org.apache.cxf.helpers.XPathUtils

        ns.put("tns", "http://cxf.apache.org/systest/jaxws/DocLitWrappedCodeFirstService");
        ns.put("wsdl", "http://schemas.xmlsoap.org/wsdl/");
        ns.put("xs", "http://www.w3.org/2001/XMLSchema");
       
       
        XPathUtils xu = new XPathUtils(ns);
       
        //make sure the wrapper types are anonymous types
        Node ct = (Node) xu.getValue("//wsdl:definitions/wsdl:types/xs:schema"
                                     + "/xs:element[@name='getFooSetResponse']/xs:complexType/xs:sequence",
                                     doc, XPathConstants.NODE);
        assertNotNull(ct);
       
        //make sure the params are nillable, not minOccurs=0
        ct = (Node) xu.getValue("//wsdl:definitions/wsdl:types/xs:schema"
                                + "/xs:element[@name='multiInOut']/xs:complexType/xs:sequence"
                                + "/xs:element[@nillable='true']",
                                doc, XPathConstants.NODE);
        assertNotNull(ct);
    }
View Full Code Here

Examples of org.apache.cxf.helpers.XPathUtils

            Map<String, String> ns = new HashMap<String, String>();
            ns.put("wsdl", WSDLConstants.NS_WSDL11);
            ns.put("wsu",
                   "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd");
            ns.put("wsp", Constants.URI_POLICY_13_NS);
            XPathUtils xpu = new XPathUtils(ns);
            //org.apache.cxf.helpers.XMLUtils.printDOM(wsdl);
            check(xpu, wsdl, "/wsdl:definitions/wsdl:service/wsdl:port", "TestImplPortPortPolicy");
            check(xpu, wsdl, "/wsdl:definitions/wsdl:portType/", "TestInterfacePortTypePolicy");
            check(xpu, wsdl, "/wsdl:definitions/wsdl:portType/wsdl:operation/", "echoIntPortTypeOpPolicy");
            check(xpu, wsdl, "/wsdl:definitions/wsdl:portType/wsdl:operation/wsdl:input",
                  "echoIntPortTypeOpInputPolicy");
            check(xpu, wsdl, "/wsdl:definitions/wsdl:portType/wsdl:operation/wsdl:output",
                  "echoIntPortTypeOpOutputPolicy");
            check(xpu, wsdl, "/wsdl:definitions/wsdl:binding/", "TestImplServiceSoapBindingBindingPolicy");
            check(xpu, wsdl, "/wsdl:definitions/wsdl:binding/wsdl:operation/", "echoIntBindingOpPolicy");
            check(xpu, wsdl, "/wsdl:definitions/wsdl:binding/wsdl:operation/wsdl:input",
                  "echoIntBindingOpInputPolicy");
            check(xpu, wsdl, "/wsdl:definitions/wsdl:binding/wsdl:operation/wsdl:output",
                  "echoIntBindingOpOutputPolicy");
            check(xpu, wsdl, "/wsdl:definitions/wsdl:service/", "TestImplServiceServicePolicy");
           
            assertEquals(1,
                         xpu.getValueList("/wsdl:definitions/wsdl:binding/wsdl:operation/"
                                              + "wsp:PolicyReference[@URI='#echoIntBindingOpPolicy']", wsdl)
                             .getLength());
           
            EndpointPolicy policy = bus.getExtension(PolicyEngine.class)
                .getServerEndpointPolicy(s.getEndpoint().getEndpointInfo(), null);
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.