@Test @RunAsClient public void testWSDLAccess() throws Exception { URL wsdlURL = new URL(baseURL + "/ProviderEndpoint?wsdl"); Element wsdl = DOMUtils.parse(wsdlURL.openStream()); assertNotNull(wsdl); }
@Test @RunAsClient public void testWSDLSchema() throws Exception { URL wsdlURL = new URL(baseURL + "/jaxws-jbws1904?wsdl"); Document doc = DOMUtils.getDocumentBuilder().parse(wsdlURL.toString()); NodeList schemas = ((Element) doc.getDocumentElement() .getElementsByTagNameNS("http://schemas.xmlsoap.org/wsdl/", "types") .item(0)) .getElementsByTagNameNS("http://www.w3.org/2001/XMLSchema", "schema"); boolean firstTypeFound = false; boolean secondTypeFound = false; for (int i = 0; i < schemas.getLength(); i++) { Element schema = (Element) schemas.item(i); if (schema.getAttribute("targetNamespace").equals("http://org.jboss.ws/jbws1904/faults")) { Iterator<?> elements = DOMUtils.getChildElements( schema, new QName("http://www.w3.org/2001/XMLSchema", "element")); while (elements.hasNext()) { Element e = (Element) elements.next(); boolean nameEquals = e.getAttribute("name").equals("UserExceptionFault"); boolean typeEquals = e.getAttribute("type").endsWith(":UserException"); if (nameEquals && typeEquals) { firstTypeFound = true; } } } if (schema .getAttribute("targetNamespace") .equals("http://org.jboss.ws/jbws1904/exceptions")) { Iterator<?> elements = DOMUtils.getChildElements( schema, new QName("http://www.w3.org/2001/XMLSchema", "complexType")); while (elements.hasNext()) { Element e = (Element) elements.next(); boolean nameEquals = e.getAttribute("name").equals("UserException"); if (nameEquals) { secondTypeFound = true; } } } } assertTrue(firstTypeFound && secondTypeFound); }