You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Fabrício <fa...@de9.ime.eb.br> on 2005/10/01 20:02:08 UTC

Getting complex type schema from WSDL with WSDL4J

Hello all,

 

I have to parse my wsdl files and identify the types, specially the Complex
types. An example of my wsdl file is:

 

<wsdl:types>

  <schema targetNamespace="urn:WSPessoa"
xmlns="http://www.w3.org/2001/XMLSchema">

   <import namespace="http://schemas.xmlsoap.org/soap/encoding/"/>

   <complexType name="Pessoa">

    <sequence>

     <element name="idade" type="xsd:int"/>

     <element name="nome" nillable="true" type="soapenc:string"/>

    </sequence>

   </complexType>

   <complexType name="ArrayOfPessoa">

    <complexContent>

     <restriction base="soapenc:Array">

      <attribute ref="soapenc:arrayType" wsdl:arrayType="tns1:Pessoa[]"/>

     </restriction>

    </complexContent>

   </complexType>

  </schema>

 </wsdl:types>

 

And I’m trying to get it using WSDL4J API as:

 

WSDLFactory wsdlFactory = WSDLFactory.newInstance();

WSDLReader wsdlReader = wsdlFactory.newWSDLReader();

Definition definition = wsdlReader.readWSDL(wsdlURI);

                  

Types myWsdlTypes = definition.getTypes();

Element element = myWsdlTypes.getDocumentationElement();

 

But I’m always receiving NULL in my element. Could you tell me why this is
happening?

 

Thanks a lot,

 

Fabrício.


Re: Getting complex type schema from WSDL with WSDL4J

Posted by Anne Thomas Manes <at...@gmail.com>.
Your WSDL doesn't have a <wsdl:documentation> element, therefore it's
expected that you would get a NULL response.

>From the Types class you can get the list of schemas (getSchemas() method).
Then you need to use a schema API to parse the schema.

Anne

On 10/1/05, Fabrício <fa...@de9.ime.eb.br> wrote:
>
>  Hello all,
>
>  I have to parse my wsdl files and identify the types, specially the
> Complex types. An example of my wsdl file is:
>
>  <wsdl:types>
>
> <schema targetNamespace="urn:WSPessoa" xmlns="
> http://www.w3.org/2001/XMLSchema">
>
> <import namespace="http://schemas.xmlsoap.org/soap/encoding/"/<http://schemas.xmlsoap.org/soap/encoding/%22/>
> >
>
> <complexType name="Pessoa">
>
> <sequence>
>
> <element name="idade" type="xsd:int"/>
>
> <element name="nome" nillable="true" type="soapenc:string"/>
>
> </sequence>
>
> </complexType>
>
> <complexType name="ArrayOfPessoa">
>
> <complexContent>
>
> <restriction base="soapenc:Array">
>
> <attribute ref="soapenc:arrayType" wsdl:arrayType="tns1:Pessoa[]"/>
>
> </restriction>
>
> </complexContent>
>
> </complexType>
>
> </schema>
>
> </wsdl:types>
>
>  And I'm trying to get it using WSDL4J API as:
>
>  WSDLFactory wsdlFactory = WSDLFactory.newInstance();
>
> WSDLReader wsdlReader = wsdlFactory.newWSDLReader();
>
> Definition definition = wsdlReader.readWSDL(wsdlURI);
>
>  Types myWsdlTypes = definition.getTypes();
>
> Element element = myWsdlTypes.getDocumentationElement();
>
>  But I'm always receiving NULL in my element. Could you tell me why this
> is happening?
>
>  Thanks a lot,
>
>  Fabrício.
>