Search in sources :

Example 11 with Definition

use of javax.wsdl.Definition in project carbon-business-process by wso2.

the class ArchiveBasedHumanTaskDeploymentUnitBuilder method readInTheWSDLFile.

/**
 * Read the WSDL file given the input stream for the WSDL source
 *
 * @param in           WSDL input stream
 * @param entryName    ZIP file entry name
 * @param fromRegistry whether the wsdl is read from registry
 * @return WSDL Definition
 * @throws javax.wsdl.WSDLException at parser error
 */
public static Definition readInTheWSDLFile(InputStream in, String entryName, boolean fromRegistry) throws WSDLException {
    WSDLReader reader = WSDLFactory.newInstance().newWSDLReader();
    // switch off the verbose mode for all usecases
    reader.setFeature(HumanTaskConstants.JAVAX_WSDL_VERBOSE_MODE_KEY, false);
    reader.setFeature("javax.wsdl.importDocuments", true);
    Definition def;
    Document doc;
    try {
        doc = XMLUtils.newDocument(in);
    } catch (ParserConfigurationException e) {
        throw new WSDLException(WSDLException.PARSER_ERROR, "Parser Configuration Error", e);
    } catch (SAXException e) {
        throw new WSDLException(WSDLException.PARSER_ERROR, "Parser SAX Error", e);
    } catch (IOException e) {
        throw new WSDLException(WSDLException.INVALID_WSDL, "IO Error", e);
    }
    // Log when and from where the WSDL is loaded.
    if (log.isDebugEnabled()) {
        log.debug("Reading 1.1 WSDL with base uri = " + entryName);
        log.debug("  the document base uri = " + entryName);
    }
    if (fromRegistry) {
        throw new UnsupportedOperationException("This operation is not currently " + "supported in this version of WSO2 BPS.");
    } else {
        def = reader.readWSDL(entryName, doc.getDocumentElement());
    }
    def.setDocumentBaseURI(entryName);
    return def;
}
Also used : WSDLException(javax.wsdl.WSDLException) Definition(javax.wsdl.Definition) ParserConfigurationException(javax.xml.parsers.ParserConfigurationException) HumanInteractionsDocument(org.wso2.carbon.humantask.HumanInteractionsDocument) HTDeploymentConfigDocument(org.wso2.carbon.humantask.core.deployment.config.HTDeploymentConfigDocument) Document(org.w3c.dom.Document) WSDLReader(javax.wsdl.xml.WSDLReader) SAXException(org.xml.sax.SAXException)

Example 12 with Definition

use of javax.wsdl.Definition in project ofbiz-framework by apache.

the class ModelService method toWSDL.

public Document toWSDL(String locationURI) throws WSDLException {
    WSDLFactory factory = WSDLFactory.newInstance();
    Definition def = factory.newDefinition();
    def.setTargetNamespace(TNS);
    def.addNamespace("xsd", XSD);
    def.addNamespace("tns", TNS);
    def.addNamespace("soap", "http://schemas.xmlsoap.org/wsdl/soap/");
    this.getWSDL(def, locationURI);
    return factory.newWSDLWriter().getDocument(def);
}
Also used : WSDLFactory(javax.wsdl.factory.WSDLFactory) Definition(javax.wsdl.Definition)

Example 13 with Definition

use of javax.wsdl.Definition in project jbossws-cxf by jbossws.

the class JBWS1505TestCase method testWSDLGeneration.

/**
 * All methods on the SEI should be mapped.
 *
 * @throws Exception
 */
@Test
@RunAsClient
public void testWSDLGeneration() throws Exception {
    Definition wsdl = WSDLFactory.newInstance().newWSDLReader().readWSDL(wsdlURL.toString());
    Map<?, ?> services = wsdl.getAllServices();
    // a simple port
    assertTrue(services.size() == 1);
    javax.wsdl.Service service = (javax.wsdl.Service) services.values().iterator().next();
    javax.wsdl.Port port = (javax.wsdl.Port) service.getPorts().values().iterator().next();
    // with five op's
    assertTrue(port.getBinding().getBindingOperations().size() == 5);
}
Also used : Definition(javax.wsdl.Definition) Service(javax.xml.ws.Service) RunAsClient(org.jboss.arquillian.container.test.api.RunAsClient) Test(org.junit.Test) JBossWSTest(org.jboss.wsf.test.JBossWSTest)

Example 14 with Definition

use of javax.wsdl.Definition in project jbossws-cxf by jbossws.

the class JBWS1529TestCase method testWSDLReader.

@Test
@RunAsClient
public void testWSDLReader() throws Exception {
    File wsdlFile = getResourceFile("jaxws/jbws1529/META-INF/wsdl/JBWS1529Service.wsdl");
    assertTrue(wsdlFile.exists());
    WSDLReader wsdlReader = WSDLFactory.newInstance().newWSDLReader();
    Definition wsdl = wsdlReader.readWSDL(wsdlFile.getAbsolutePath());
    assertNotNull(wsdl);
}
Also used : Definition(javax.wsdl.Definition) File(java.io.File) WSDLReader(javax.wsdl.xml.WSDLReader) RunAsClient(org.jboss.arquillian.container.test.api.RunAsClient) Test(org.junit.Test) JBossWSTest(org.jboss.wsf.test.JBossWSTest)

Example 15 with Definition

use of javax.wsdl.Definition in project jbossws-cxf by jbossws.

the class EndpointTestCase method readWSDL.

private void readWSDL(URL wsdlURL) throws Exception {
    WSDLReader wsdlReader = WSDLFactory.newInstance().newWSDLReader();
    Definition wsdlDefinition = wsdlReader.readWSDL(wsdlURL.toString());
    assertNotNull(wsdlDefinition);
}
Also used : Definition(javax.wsdl.Definition) WSDLReader(javax.wsdl.xml.WSDLReader)

Aggregations

Definition (javax.wsdl.Definition)226 Test (org.junit.Test)113 QName (javax.xml.namespace.QName)61 File (java.io.File)52 Document (org.w3c.dom.Document)44 Element (org.w3c.dom.Element)40 HashMap (java.util.HashMap)36 WSDLReader (javax.wsdl.xml.WSDLReader)35 RunAsClient (org.jboss.arquillian.container.test.api.RunAsClient)31 JBossWSTest (org.jboss.wsf.test.JBossWSTest)31 Service (javax.wsdl.Service)24 ExtensibilityElement (javax.wsdl.extensions.ExtensibilityElement)23 URL (java.net.URL)21 ArrayList (java.util.ArrayList)21 Port (javax.wsdl.Port)21 WSDLToIDLAction (org.apache.cxf.tools.corba.processors.wsdl.WSDLToIDLAction)21 Bus (org.apache.cxf.Bus)20 ServiceInfo (org.apache.cxf.service.model.ServiceInfo)20 WSDLManager (org.apache.cxf.wsdl.WSDLManager)20 IOException (java.io.IOException)18