use of javax.wsdl.xml.WSDLReader in project cxf by apache.
the class WSDLGenerationTester method writeDefinition.
public File writeDefinition(File targetDir, File defnFile) throws Exception {
WSDLManager wm = BusFactory.getThreadDefaultBus().getExtension(WSDLManager.class);
WSDLFactory factory = WSDLFactory.newInstance("org.apache.cxf.tools.corba.utils.TestWSDLCorbaFactoryImpl");
WSDLReader reader = factory.newWSDLReader();
reader.setFeature("javax.wsdl.importDocuments", false);
reader.setExtensionRegistry(wm.getExtensionRegistry());
final String url = defnFile.toString();
CatalogWSDLLocator locator = new CatalogWSDLLocator(url, (Bus) null);
Definition wsdlDefn = reader.readWSDL(locator);
File bkFile = new File(targetDir, "bk_" + defnFile.getName());
try (Writer writer = Files.newBufferedWriter(bkFile.toPath())) {
factory.newWSDLWriter().writeWSDL(wsdlDefn, writer);
}
return bkFile;
}
use of javax.wsdl.xml.WSDLReader in project cxf by apache.
the class JavaToProcessorTest method getDefinition.
private Definition getDefinition(String wsdl) throws WSDLException {
WSDLFactory wsdlFactory = WSDLFactory.newInstance();
WSDLReader wsdlReader = wsdlFactory.newWSDLReader();
wsdlReader.setFeature("javax.wsdl.verbose", false);
return wsdlReader.readWSDL(wsdl);
}
use of javax.wsdl.xml.WSDLReader in project cxf by apache.
the class AegisTest method testAegisBasic.
@Test
public void testAegisBasic() throws Exception {
final String sei = org.apache.cxf.tools.fortest.aegis2ws.TestAegisSEI.class.getName();
File wsdlFile = new File(folder.getRoot(), "aegis.wsdl");
String[] args = new String[] { "-wsdl", "-o", wsdlFile.toString(), "-verbose", "-d", folder.getRoot().toString(), "-s", folder.getRoot().toString(), "-frontend", "jaxws", "-databinding", "aegis", "-client", "-server", sei };
JavaToWS.main(args);
assertTrue("wsdl is not generated", wsdlFile.exists());
WSDLReader reader = WSDLFactory.newInstance().newWSDLReader();
reader.setFeature("javax.wsdl.verbose", false);
Definition def = reader.readWSDL(wsdlFile.toURI().toURL().toString());
Document wsdl = WSDLFactory.newInstance().newWSDLWriter().getDocument(def);
assertValid("//xsd:element[@type='ns0:Something']", wsdl);
}
use of javax.wsdl.xml.WSDLReader in project cxf by apache.
the class CXFServletTest method testGetWSDLWithMultiplePublishedEndpointUrl.
@Test
public void testGetWSDLWithMultiplePublishedEndpointUrl() throws Exception {
ServletUnitClient client = newClient();
client.setExceptionsThrownOnErrorStatus(true);
WebRequest req = new GetMethodQueryWebRequest(CONTEXT_URL + "/services/greeter5?wsdl");
WebResponse res = client.getResponse(req);
assertEquals(200, res.getResponseCode());
assertEquals("text/xml", res.getContentType());
Document doc = StaxUtils.read(res.getInputStream());
assertNotNull(doc);
WSDLReader wsdlReader = WSDLFactory.newInstance().newWSDLReader();
wsdlReader.setFeature("javax.wsdl.verbose", false);
assertValid("//wsdl:service[@name='SOAPService']/wsdl:port[@name='SoapPort']/wsdlsoap:address[@location='" + "http://cxf.apache.org/publishedEndpointUrl1']", doc);
assertValid("//wsdl:service[@name='SOAPService']/wsdl:port[@name='SoapPort1']/wsdlsoap:address[@location='" + "http://cxf.apache.org/publishedEndpointUrl2']", doc);
}
use of javax.wsdl.xml.WSDLReader in project iaf by ibissource.
the class SchemaLocation method setWsdl.
@IbisDoc({ "the wsdl to read the xsd's from", " " })
public void setWsdl(String wsdl) throws ConfigurationException {
this.wsdl = wsdl;
WSDLReader reader = FACTORY.newWSDLReader();
reader.setFeature("javax.wsdl.verbose", false);
reader.setFeature("javax.wsdl.importDocuments", true);
ClassLoaderWSDLLocator wsdlLocator = new ClassLoaderWSDLLocator(this, wsdl);
URL url = wsdlLocator.getUrl();
if (wsdlLocator.getUrl() == null) {
throw new ConfigurationException("Could not find WSDL: " + wsdl);
}
try {
definition = reader.readWSDL(wsdlLocator);
} catch (WSDLException e) {
throw new ConfigurationException("WSDLException reading WSDL or import from url: " + url, e);
}
if (wsdlLocator.getIOException() != null) {
throw new ConfigurationException("IOException reading WSDL or import from url: " + url, wsdlLocator.getIOException());
}
}
Aggregations