Search in sources :

Example 21 with WSDLReader

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;
}
Also used : WSDLFactory(javax.wsdl.factory.WSDLFactory) Definition(javax.wsdl.Definition) WSDLManager(org.apache.cxf.wsdl.WSDLManager) CatalogWSDLLocator(org.apache.cxf.wsdl11.CatalogWSDLLocator) File(java.io.File) WSDLReader(javax.wsdl.xml.WSDLReader) Writer(java.io.Writer)

Example 22 with WSDLReader

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);
}
Also used : WSDLFactory(javax.wsdl.factory.WSDLFactory) WSDLReader(javax.wsdl.xml.WSDLReader)

Example 23 with WSDLReader

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);
}
Also used : Definition(javax.wsdl.Definition) Document(org.w3c.dom.Document) File(java.io.File) WSDLReader(javax.wsdl.xml.WSDLReader) Test(org.junit.Test)

Example 24 with WSDLReader

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);
}
Also used : WebResponse(com.meterware.httpunit.WebResponse) WebRequest(com.meterware.httpunit.WebRequest) GetMethodWebRequest(com.meterware.httpunit.GetMethodWebRequest) PostMethodWebRequest(com.meterware.httpunit.PostMethodWebRequest) ServletUnitClient(com.meterware.servletunit.ServletUnitClient) Document(org.w3c.dom.Document) WSDLReader(javax.wsdl.xml.WSDLReader) Test(org.junit.Test)

Example 25 with WSDLReader

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());
    }
}
Also used : ConfigurationException(nl.nn.adapterframework.configuration.ConfigurationException) WSDLException(javax.wsdl.WSDLException) WSDLReader(javax.wsdl.xml.WSDLReader) URL(java.net.URL) IbisDoc(nl.nn.adapterframework.doc.IbisDoc)

Aggregations

WSDLReader (javax.wsdl.xml.WSDLReader)60 Definition (javax.wsdl.Definition)35 WSDLFactory (javax.wsdl.factory.WSDLFactory)25 WSDLException (javax.wsdl.WSDLException)16 URL (java.net.URL)15 Test (org.junit.Test)13 Service (javax.wsdl.Service)8 File (java.io.File)7 RunAsClient (org.jboss.arquillian.container.test.api.RunAsClient)7 JBossWSTest (org.jboss.wsf.test.JBossWSTest)7 Document (org.w3c.dom.Document)7 QName (javax.xml.namespace.QName)6 InputSource (org.xml.sax.InputSource)6 ByteArrayInputStream (java.io.ByteArrayInputStream)5 Bus (org.apache.cxf.Bus)5 APIManagementException (org.wso2.carbon.apimgt.api.APIManagementException)5 APIMgtWSDLException (org.wso2.carbon.apimgt.impl.wsdl.exceptions.APIMgtWSDLException)5 IOException (java.io.IOException)4 ArrayList (java.util.ArrayList)4 HashMap (java.util.HashMap)4