Package org.apache.cxf.helpers

Examples of org.apache.cxf.helpers.XPathUtils


        Document doc = StaxUtils.read(wsdlFile);
        Map<String, String> map = new HashMap<String, String>();
        map.put("xsd", "http://www.w3.org/2001/XMLSchema");
        map.put("wsdl", "http://schemas.xmlsoap.org/wsdl/");
        map.put("soap", "http://schemas.xmlsoap.org/wsdl/soap/");
        XPathUtils util = new XPathUtils(map);
       
        assertNotNull(util.getValueNode("//xsd:complexType[@name='Exception']", doc));

        Element nd = (Element)util.getValueNode("//xsd:element[@name='Exception']", doc);
        assertNotNull(nd);
        assertTrue(nd.getAttribute("type").contains("Exception"));
       
        nd = (Element)util.getValueNode("//xsd:element[@name='message']", doc);
        assertNotNull(nd);
        assertTrue(nd.getAttribute("type").contains("string"));
        assertTrue(nd.getAttribute("minOccurs").contains("0"));
       
        nd = (Element)util.getValueNode("//wsdl:part[@name='Exception']", doc);
        assertNotNull(nd);
        assertTrue(nd.getAttribute("element").contains(":Exception"));

        nd = (Element)util.getValueNode("//wsdl:fault[@name='Exception']", doc);
        assertNotNull(nd);
        assertTrue(nd.getAttribute("message").contains(":Exception"));

        nd = (Element)util.getValueNode("//soap:fault[@name='Exception']", doc);
        assertNotNull(nd);
        assertTrue(nd.getAttribute("use").contains("literal"));
    }
View Full Code Here


        Document doc = StaxUtils.read(wsdlFile);
        Map<String, String> map = new HashMap<String, String>();
        map.put("xsd", "http://www.w3.org/2001/XMLSchema");
        map.put("wsdl", "http://schemas.xmlsoap.org/wsdl/");
        map.put("soap", "http://schemas.xmlsoap.org/wsdl/soap/");
        XPathUtils util = new XPathUtils(map);

        Element summary = (Element)util.getValueNode("//xsd:element[@name='summary']", doc);
        Element from = (Element)util.getValueNode("//xsd:element[@name='from']", doc);
        Element id = (Element)util.getValueNode("//xsd:element[@name='id']", doc);
        assertNotNull(summary);
        assertNotNull(from);
        assertNotNull(id);
       
        Node nd = summary.getNextSibling();
View Full Code Here

        Document doc = StaxUtils.read(wsdlFile);
        Map<String, String> map = new HashMap<String, String>();
        map.put("xsd", "http://www.w3.org/2001/XMLSchema");
        map.put("wsdl", "http://schemas.xmlsoap.org/wsdl/");
        map.put("soap", "http://schemas.xmlsoap.org/wsdl/soap/");
        XPathUtils util = new XPathUtils(map);

        Element summary = (Element)util.getValueNode("//xsd:element[@name='summary']", doc);
        Element from = (Element)util.getValueNode("//xsd:element[@name='from']", doc);
        Element id = (Element)util.getValueNode("//xsd:element[@name='id']", doc);
        assertNotNull(summary);
        assertNotNull(from);
        assertNotNull(id);
       
        Node nd = from.getNextSibling();
View Full Code Here

        Document doc = StaxUtils.read(wsdlFile);
        Map<String, String> map = new HashMap<String, String>();
        map.put("xsd", "http://www.w3.org/2001/XMLSchema");
        map.put("wsdl", "http://schemas.xmlsoap.org/wsdl/");
        map.put("soap", "http://schemas.xmlsoap.org/wsdl/soap/");
        XPathUtils util = new XPathUtils(map);

        Element nd = (Element)util.getValueNode("//xsd:element[@name='names']", doc);
        assertNotNull(nd);
        assertEquals("0", nd.getAttribute("minOccurs"));
        assertEquals("unbounded", nd.getAttribute("maxOccurs"));
        assertTrue(nd.getAttribute("type").endsWith(":myData"));
       
       
        nd = (Element)util.getValueNode("//xsd:complexType[@name='ListException2']"
                                        + "/xsd:sequence/xsd:element[@name='address']", doc);
        assertNotNull(nd);
        assertEquals("0", nd.getAttribute("minOccurs"));
        assertEquals("unbounded", nd.getAttribute("maxOccurs"));
        assertTrue(nd.getAttribute("type").endsWith(":myData"));
View Full Code Here

        Map<String, String> map = new HashMap<String, String>();
        map.put("xsd", "http://www.w3.org/2001/XMLSchema");
        map.put("wsdl", "http://schemas.xmlsoap.org/wsdl/");
        map.put("soap", "http://schemas.xmlsoap.org/wsdl/soap/");
        map.put("tns", "http://cxf.apache.org/test/HelloService");
        XPathUtils util = new XPathUtils(map);
       
        Element el = (Element)util.getValueNode("//xsd:element[@ref]", doc);
        assertNotNull(el);
        assertTrue(el.getAttribute("ref").contains("item"));
    }
View Full Code Here

        Document doc = StaxUtils.read(file);
        Map<String, String> map = new HashMap<String, String>();
        map.put("xsd", "http://www.w3.org/2001/XMLSchema");
        map.put("wsdl", "http://schemas.xmlsoap.org/wsdl/");
        map.put("soap", "http://schemas.xmlsoap.org/wsdl/soap/");
        XPathUtils util = new XPathUtils(map);
        Element node = (Element)util.getValueNode("//xsd:list", doc);
        assertNotNull(node);

        assertTrue(node.getAttribute("itemType").contains("string"));
    }
View Full Code Here

        Document doc = StaxUtils.read(file);
        Map<String, String> map = new HashMap<String, String>();
        map.put("xsd", "http://www.w3.org/2001/XMLSchema");
        map.put("wsdl", "http://schemas.xmlsoap.org/wsdl/");
        map.put("soap", "http://schemas.xmlsoap.org/wsdl/soap/");
        XPathUtils util = new XPathUtils(map);
        Element node = (Element)util.getValueNode("//xsd:element[@name='arg0']", doc);
        assertNotNull(node);

        assertEquals("0", node.getAttribute("minOccurs"));
        assertTrue(node.getAttribute("type").contains("string"));
    }
View Full Code Here

        File wsdlFile = new File(output, "exception-type-adapter.wsdl");
        assertTrue(wsdlFile.exists());
        Document doc = StaxUtils.read(wsdlFile);
        Map<String, String> map = new HashMap<String, String>();
        map.put("xsd", "http://www.w3.org/2001/XMLSchema");
        XPathUtils util = new XPathUtils(map);
        Node nd = util.getValueNode("//xsd:complexType[@name='myClass2']", doc);
        assertNotNull(nd);
       
        nd = util.getValueNode("//xsd:element[@name='adapted']", doc);
        assertNotNull(nd);
       
        String at = ((Element)nd).getAttribute("type");
        assertTrue(at.contains("myClass2"));
        assertEquals("0", ((Element)nd).getAttribute("minOccurs"));
View Full Code Here

       
        Map<String, String> ns = new HashMap<String, String>();
        ns.put("xsd", "http://www.w3.org/2001/XMLSchema");
        ns.put("wsdl", "http://schemas.xmlsoap.org/wsdl/");
        ns.put("tns", "http://cxf.apache.org/test/HelloService");
        XPathUtils xpu = new XPathUtils(ns);
       

        Node nd = xpu.getValueNode("//xsd:complexType[@name='objectWithGenerics']", doc);
        assertNotNull(nd);
        assertNotNull(xpu.getValueNode("//xsd:element[@name='a']", nd));
        assertNotNull(xpu.getValueNode("//xsd:element[@name='b']", nd));
       
        Service service = Service.create(wsdlURL, serviceName);
        service.addPort(new QName("http://cxf.apache.org/test/HelloService", "HelloPort"),
                        SOAPBinding.SOAP11HTTP_BINDING, address);
        GenericsEcho port = service
View Full Code Here

    }
   
    private void setStackTrace(Fault fault, Message msg) {
        Throwable cause = null;
        Map<String, String> ns = new HashMap<String, String>();
        XPathUtils xu = new XPathUtils(ns);
        ns.put("s", Fault.STACKTRACE_NAMESPACE);
        String ss = (String) xu.getValue("//s:" + Fault.STACKTRACE + "/text()", fault.getDetail(),
                XPathConstants.STRING);
        List<StackTraceElement> stackTraceList = new ArrayList<StackTraceElement>();
        if (!StringUtils.isEmpty(ss)) {
            StringTokenizer st = new StringTokenizer(ss, Message.EXCEPTION_CAUSE_SUFFIX);
            while (st.hasMoreTokens()) {
View Full Code Here

TOP

Related Classes of org.apache.cxf.helpers.XPathUtils

Copyright © 2018 www.massapicom. 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.