Search in sources :

Example 1 with WSDLFactory

use of javax.wsdl.factory.WSDLFactory in project Activiti by Activiti.

the class WSDLImporter method parseWSDLDefinition.

/**
   * Parse the WSDL definition using WSDL4J.
   */
private Definition parseWSDLDefinition() throws WSDLException {
    WSDLFactory wsdlFactory = WSDLFactory.newInstance();
    WSDLReader reader = wsdlFactory.newWSDLReader();
    reader.setFeature("javax.wsdl.verbose", false);
    reader.setFeature("javax.wsdl.importDocuments", true);
    Definition definition = reader.readWSDL(this.wsdlLocation);
    return definition;
}
Also used : WSDLFactory(javax.wsdl.factory.WSDLFactory) StructureDefinition(org.activiti.engine.impl.bpmn.data.StructureDefinition) SimpleStructureDefinition(org.activiti.engine.impl.bpmn.data.SimpleStructureDefinition) Definition(javax.wsdl.Definition) WSDLReader(javax.wsdl.xml.WSDLReader)

Example 2 with WSDLFactory

use of javax.wsdl.factory.WSDLFactory in project wso2-synapse by wso2.

the class WSDL11EndpointBuilder method populateEndpointDefinitionFromWSDL.

/**
 * Creates an EndpointDefinition for WSDL endpoint from an inline WSDL supplied in the WSDL
 * endpoint configuration.
 *
 * @param endpointDefinition the endpoint definition to populate
 * @param baseUri base uri of the wsdl
 * @param wsdl    OMElement representing the inline WSDL
 * @param service Service of the endpoint
 * @param port    Port of the endpoint
 * @return EndpointDefinition containing the information retrieved from the WSDL
 */
public EndpointDefinition populateEndpointDefinitionFromWSDL(EndpointDefinition endpointDefinition, String baseUri, OMElement wsdl, String service, String port) {
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    try {
        wsdl.serialize(baos);
        InputStream in = new ByteArrayInputStream(baos.toByteArray());
        InputSource inputSource = new InputSource(in);
        WSDLLocator wsdlLocator = new CustomWSDLLocator(inputSource, baseUri);
        Document doc = null;
        try {
            doc = XMLUtils.newDocument(inputSource);
        } catch (ParserConfigurationException e) {
            handleException("Parser Configuration Error", e);
        } catch (SAXException e) {
            handleException("Parser SAX Error", e);
        } catch (IOException e) {
            handleException(WSDLException.INVALID_WSDL + "IO Error", e);
        }
        if (doc != null) {
            WSDLFactory fac = WSDLFactory.newInstance();
            WSDLReader reader = fac.newWSDLReader();
            Definition definition = reader.readWSDL(wsdlLocator, doc.getDocumentElement());
            return createEndpointDefinitionFromWSDL(endpointDefinition, definition, service, port);
        }
    } catch (XMLStreamException e) {
        handleException("Error retrieving the WSDL definition from the inline WSDL.", e);
    } catch (WSDLException e) {
        handleException("Error retrieving the WSDL definition from the inline WSDL.", e);
    }
    return null;
}
Also used : WSDLLocator(javax.wsdl.xml.WSDLLocator) CustomWSDLLocator(org.apache.synapse.util.resolver.CustomWSDLLocator) InputSource(org.xml.sax.InputSource) ByteArrayInputStream(java.io.ByteArrayInputStream) InputStream(java.io.InputStream) EndpointDefinition(org.apache.synapse.endpoints.EndpointDefinition) ByteArrayOutputStream(java.io.ByteArrayOutputStream) IOException(java.io.IOException) Document(org.w3c.dom.Document) SAXException(org.xml.sax.SAXException) XMLStreamException(javax.xml.stream.XMLStreamException) ByteArrayInputStream(java.io.ByteArrayInputStream) WSDLFactory(javax.wsdl.factory.WSDLFactory) CustomWSDLLocator(org.apache.synapse.util.resolver.CustomWSDLLocator) ParserConfigurationException(javax.xml.parsers.ParserConfigurationException) WSDLReader(javax.wsdl.xml.WSDLReader)

Example 3 with WSDLFactory

use of javax.wsdl.factory.WSDLFactory in project teiid by teiid.

the class WSDLMetadataProcessor method process.

@Override
public void process(MetadataFactory mf, WSConnection connection) throws TranslatorException {
    if (this.importWSDL && connection == null) {
        throw new TranslatorException(WSExecutionFactory.UTIL.gs(Event.TEIID15007, WSExecutionFactory.UTIL.gs(Event.TEIID15007)));
    }
    if (!importWSDL || connection.getWsdl() == null) {
        return;
    }
    String wsdl = connection.getWsdl().toString();
    try {
        WSDLFactory wsdlFactory = WSDLFactory.newInstance();
        WSDLReader reader = wsdlFactory.newWSDLReader();
        this.definition = reader.readWSDL(wsdl);
    } catch (WSDLException e) {
        throw new TranslatorException(e);
    }
    Map<QName, Service> services = this.definition.getServices();
    if (services == null || services.isEmpty()) {
        throw new TranslatorException(WSExecutionFactory.UTIL.gs(WSExecutionFactory.Event.TEIID15001, connection.getServiceQName()));
    }
    Service service = services.get(connection.getServiceQName());
    if (service == null) {
        throw new TranslatorException(WSExecutionFactory.UTIL.gs(WSExecutionFactory.Event.TEIID15001, connection.getServiceQName()));
    }
    Map<String, Port> ports = service.getPorts();
    Port port = ports.get(connection.getPortQName().getLocalPart());
    if (port == null) {
        throw new TranslatorException(WSExecutionFactory.UTIL.gs(WSExecutionFactory.Event.TEIID15002, connection.getPortQName(), connection.getServiceQName()));
    }
    getPortMetadata(mf, port);
}
Also used : WSDLFactory(javax.wsdl.factory.WSDLFactory) WSDLException(javax.wsdl.WSDLException) QName(javax.xml.namespace.QName) Port(javax.wsdl.Port) Service(javax.wsdl.Service) TranslatorException(org.teiid.translator.TranslatorException) WSDLReader(javax.wsdl.xml.WSDLReader)

Example 4 with WSDLFactory

use of javax.wsdl.factory.WSDLFactory 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 5 with WSDLFactory

use of javax.wsdl.factory.WSDLFactory in project jbossws-cxf by jbossws.

the class JBossWebServicesEarTestCase method getWSDLDefinition.

private Definition getWSDLDefinition(String wsdlLocation) throws Exception {
    WSDLFactory wsdlFactory = WSDLFactory.newInstance();
    WSDLReader wsdlReader = wsdlFactory.newWSDLReader();
    Definition definition = wsdlReader.readWSDL(null, wsdlLocation);
    return definition;
}
Also used : WSDLFactory(javax.wsdl.factory.WSDLFactory) Definition(javax.wsdl.Definition) WSDLReader(javax.wsdl.xml.WSDLReader)

Aggregations

WSDLFactory (javax.wsdl.factory.WSDLFactory)28 WSDLReader (javax.wsdl.xml.WSDLReader)25 Definition (javax.wsdl.Definition)13 URL (java.net.URL)6 Service (javax.wsdl.Service)5 WSDLException (javax.wsdl.WSDLException)5 QName (javax.xml.namespace.QName)4 ArrayList (java.util.ArrayList)3 Port (javax.wsdl.Port)3 ExtensionRegistry (javax.wsdl.extensions.ExtensionRegistry)3 Bus (org.apache.cxf.Bus)3 BindingFactoryManager (org.apache.cxf.binding.BindingFactoryManager)3 DestinationFactoryManager (org.apache.cxf.transport.DestinationFactoryManager)3 WSDLManager (org.apache.cxf.wsdl.WSDLManager)3 CatalogWSDLLocator (org.apache.cxf.wsdl11.CatalogWSDLLocator)3 IOException (java.io.IOException)2 InvocationTargetException (java.lang.reflect.InvocationTargetException)2 Method (java.lang.reflect.Method)2 HashMap (java.util.HashMap)2 Hashtable (java.util.Hashtable)2