Search in sources :

Example 11 with WSDLFactory

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

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

use of javax.wsdl.factory.WSDLFactory in project tdi-studio-se by Talend.

the class AllTypeDialog method initSimpleType.

private void initSimpleType() throws WSDLException, URISyntaxException {
    String url = URLValue;
    XmlSchemaCollection schemaCollection = new XmlSchemaCollection();
    WSDLFactory wsdlFactory = WSDLFactory.newInstance();
    WSDLReader newWSDLReader = wsdlFactory.newWSDLReader();
    newWSDLReader.setFeature(com.ibm.wsdl.Constants.FEATURE_VERBOSE, false);
    URI wsdlURI = new URI(url);
    Definition definition = newWSDLReader.readWSDL(url);
    java.util.List<ExtensibilityElement> extensibilityElements = definition.getTypes().getExtensibilityElements();
    String tmpTNName = "";
    int tmpCount = 0;
    for (ExtensibilityElement el : extensibilityElements) {
        if (el instanceof Schema) {
            Schema schema = (Schema) el;
            // for bug 8674
            // set base uri for relative path in schemaLocation.
            schemaCollection.setBaseUri(schema.getDocumentBaseURI());
            if (schema.getElement().getAttributeNode("targetNamespace") == null) {
                tmpTNName = schema.getDocumentBaseURI() + "#type" + tmpCount;
                schemaCollection.read(schema.getElement(), tmpTNName);
                tmpCount++;
            } else {
                schemaCollection.read(schema.getElement());
            }
        }
    }
    Map namespaces = definition.getNamespaces();
    // System.out.println(namespaces);
    XmlSchema[] schemas = schemaCollection.getXmlSchemas();
    java.util.List<String> labelList = new ArrayList<String>();
    for (int i = 0; i < schemas.length; i++) {
        XmlSchema schema = schemas[i];
        XmlSchemaObjectTable types = schema.getSchemaTypes();
        Iterator it = types.getValues();
        while (it.hasNext()) {
            XmlSchemaType type = (XmlSchemaType) it.next();
            if (type instanceof XmlSchemaSimpleType) {
                XmlSchemaSimpleType t = (XmlSchemaSimpleType) type;
                String label = "simpletype:" + t.getName();
                if (!labelList.contains(label)) {
                    labelList.add(label);
                    labelAndNameSpaceMap.put(label, t.getQName().toString());
                }
            }
        }
    }
    allXMLSimpleTypeName = new String[labelList.size()];
    for (int i = 0; i < labelList.size(); i++) {
        allXMLSimpleTypeName[i] = labelList.get(i);
    }
}
Also used : XmlSchemaObjectTable(org.apache.ws.commons.schema.XmlSchemaObjectTable) XmlSchema(org.apache.ws.commons.schema.XmlSchema) Schema(javax.wsdl.extensions.schema.Schema) Definition(javax.wsdl.Definition) ArrayList(java.util.ArrayList) XmlSchemaType(org.apache.ws.commons.schema.XmlSchemaType) XmlSchemaCollection(org.apache.ws.commons.schema.XmlSchemaCollection) URI(java.net.URI) ExtensibilityElement(javax.wsdl.extensions.ExtensibilityElement) WSDLFactory(javax.wsdl.factory.WSDLFactory) XmlSchema(org.apache.ws.commons.schema.XmlSchema) XmlSchemaSimpleType(org.apache.ws.commons.schema.XmlSchemaSimpleType) Iterator(java.util.Iterator) Map(java.util.Map) HashMap(java.util.HashMap) WSDLReader(javax.wsdl.xml.WSDLReader)

Example 14 with WSDLFactory

use of javax.wsdl.factory.WSDLFactory in project Lucee by lucee.

the class JaxWSClient method loadWSDL.

private static Definition loadWSDL(URL url) throws WSDLException {
    WSDLFactory factory = WSDLFactory.newInstance();
    // create an object to read the WSDL file
    WSDLReader reader = factory.newWSDLReader();
    // pass the URL to the reader for parsing and get back a WSDL definiton
    return reader.readWSDL(url.toExternalForm());
}
Also used : WSDLFactory(javax.wsdl.factory.WSDLFactory) WSDLReader(javax.wsdl.xml.WSDLReader)

Example 15 with WSDLFactory

use of javax.wsdl.factory.WSDLFactory in project cxf by apache.

the class WSDLHelper method getDefinition.

public Definition getDefinition(File wsdlFile) throws Exception {
    WSDLFactory wsdlFactory = WSDLFactory.newInstance();
    WSDLReader reader = wsdlFactory.newWSDLReader();
    reader.setFeature("javax.wsdl.verbose", false);
    return reader.readWSDL(wsdlFile.toURI().toURL().toString());
}
Also used : WSDLFactory(javax.wsdl.factory.WSDLFactory) 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