WSDL4J does not parse types and imported schema, as far as I can tell. You can use the WSIF library, which is built on WSDL4J, to parse this information. There seem to be a couple of keys to using WSIF for this purpose, the first is using the org.apache.wsif.schema.Parser class to process the Definition returned by the WSDL parse. The second keys seems to be to write your own WSDLLocator to use with the Parser class. The default locator didn't seem to locate and read the imported schema files for me and thus initially after using the Parser class I still ended up with no types.
 
Here is a snipit of code:
 
            WSDLFactory factory;
            factory = new WSIFWSDLFactoryImpl();
            // factory = WSDLFactory.newInstance();
            WSDLReader wsdlReader = factory.newWSDLReader();
            wsdlReader.setFeature("javax.wsdl.verbose", true);
            wsdlReader.setFeature("javax.wsdl.importDocuments", true);
            Definition def = wsdlReader.readWSDL(<URI for WSDL>);
            List types = new ArrayList();
            Parser.getAllSchemaTypes(def, types, <reference to your WSDLLocator implementation>);
 
The resultant list will contain references to the Types and Elements such that you can build a map from Element names to Types.

Hope this helps ...
 
cheers,
/dkb
 


From: Fabrício [mailto:[EMAIL PROTECTED]
Sent: Monday, October 24, 2005 5:27 PM
To: axis-user@ws.apache.org
Subject: WSDL Schema Types always null

Hello all,

 

I have a web service witch has complex types defined in a <type> element and I want to read these types using WSDL4J.

 

I’m doing by this way:

 

            WSDLFactory wsdlFactory = WSDLFactory.newInstance();

            WSDLReader wsdlReader = wsdlFactory.newWSDLReader();

            Definition definition = wsdlReader.readWSDL(urlWsdl);

Types wsdlTypes = definition.getTypes();

 

But I’m always getting null to element. As you can.

 

Types:

SchemaExtensibilityElement ({http://www.w3.org/2001/XMLSchema}schema):

required=null

element=[schema: null]

 

Do you know why this is happening?

 

If anyone could help me, I would be very grateful.

 

Thanks a lot,

 

Fabricio.

Reply via email to