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 Lukas Füllemann <fu...@sowatec.com> on 2007/07/02 09:09:11 UTC

Array namespace problem

Hi 

I am using Axis 1.4 and have two webservices sharing a common type of class 'Master'. This class has an array of another class 'Detail'. 'Master' and 'Detail' are in a separate package than the two web services (which are again in different packages).
While generating the wsdl for the two webservices, each wsdl generates for the Master type an ArrayOf_tns2_Detail type descriptor defined in the namespace of the webservice and not in the namespace of the Master or Detail type. Now I use the .NET wsdl class generator, which creates two different master classes, because they contain arrays defined in different namespaces.
How can I tell Axis to use a certain namespace for the array definitions? Can Axis2 solve this problem?

Wsdl of Webservice1:
<wsdl:types>
  <schema targetNamespace="http://commonobjects.ws.arregulo.sowatec.com" xmlns="http://www.w3.org/2001/XMLSchema">
   <import namespace="http://webservice.ws1.arregulo.sowatec.com"/>
   <import namespace="http://schemas.xmlsoap.org/soap/encoding/"/>
   <complexType name="Detail">
    <sequence>
     <element name="name" nillable="true" type="xsd:string"/>
    </sequence>
   </complexType>
   <complexType name="Master">
    <sequence>
     <element name="details" nillable="true" type="impl:ArrayOf_tns2_Detail"/>
    </sequence>
   </complexType>
  </schema>
  <schema targetNamespace="http://webservice.ws1.arregulo.sowatec.com" xmlns="http://www.w3.org/2001/XMLSchema">
   <import namespace="http://commonobjects.ws.arregulo.sowatec.com"/>
   <import namespace="http://schemas.xmlsoap.org/soap/encoding/"/>
   <complexType name="ArrayOf_tns2_Detail">
    <complexContent>
     <restriction base="soapenc:Array">
      <attribute ref="soapenc:arrayType" wsdl:arrayType="tns2:Detail[]"/>
     </restriction>
    </complexContent>
   </complexType>
  </schema>
 </wsdl:types>

Wsdl of Webservice2:
<wsdl:types>
  <schema targetNamespace="http://commonobjects.ws.arregulo.sowatec.com" xmlns="http://www.w3.org/2001/XMLSchema">
   <import namespace="http://webservice.ws2.arregulo.sowatec.com"/>
   <import namespace="http://schemas.xmlsoap.org/soap/encoding/"/>
   <complexType name="Detail">
    <sequence>
     <element name="name" nillable="true" type="xsd:string"/>
    </sequence>
   </complexType>
   <complexType name="Master">
    <sequence>
     <element name="details" nillable="true" type="impl:ArrayOf_tns2_Detail"/>
    </sequence>
   </complexType>
  </schema>
  <schema targetNamespace="http://webservice.ws2.arregulo.sowatec.com" xmlns="http://www.w3.org/2001/XMLSchema">
   <import namespace="http://commonobjects.ws.arregulo.sowatec.com"/>
   <import namespace="http://schemas.xmlsoap.org/soap/encoding/"/>
   <complexType name="ArrayOf_tns2_Detail">
    <complexContent>
     <restriction base="soapenc:Array">
      <attribute ref="soapenc:arrayType" wsdl:arrayType="tns2:Detail[]"/>
     </restriction>
    </complexContent>
   </complexType>
  </schema>
 </wsdl:types>

Thanks,
Lukas


---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org


Re: Array namespace problem

Posted by Anne Thomas Manes <at...@gmail.com>.
First, if you intend to support interoperability between Axis and .NET, do
not use SOAP encoding. You should switch to wrapped document/literal style.
(specify style="Wrapped" in your WSDD). Even with wrapped style, though,
array interoperability can be tricky.

Second, if you want to use specific namespaces, you should either:
1- use the WSDL first development approach (preferred)
2- generate your WSDL using Java2WSDL and specify the Pkg2NS option. Be
prepared to tweak the generated WSDL to ensure it comes out the way you want
it to, and then run WSDL2Java.

Alternatively, you can try Axis2 (which does not support SOAP encoding, by
the way).

Anne

On 7/2/07, Lukas Füllemann <fu...@sowatec.com> wrote:
>
> Hi
>
> I am using Axis 1.4 and have two webservices sharing a common type of
> class 'Master'. This class has an array of another class 'Detail'. 'Master'
> and 'Detail' are in a separate package than the two web services (which are
> again in different packages).
> While generating the wsdl for the two webservices, each wsdl generates for
> the Master type an ArrayOf_tns2_Detail type descriptor defined in the
> namespace of the webservice and not in the namespace of the Master or Detail
> type. Now I use the .NET wsdl class generator, which creates two different
> master classes, because they contain arrays defined in different namespaces.
> How can I tell Axis to use a certain namespace for the array definitions?
> Can Axis2 solve this problem?
>
> Wsdl of Webservice1:
> <wsdl:types>
>   <schema targetNamespace="http://commonobjects.ws.arregulo.sowatec.com"
> xmlns="http://www.w3.org/2001/XMLSchema">
>    <import namespace="http://webservice.ws1.arregulo.sowatec.com"/>
>    <import namespace="http://schemas.xmlsoap.org/soap/encoding/"/>
>    <complexType name="Detail">
>     <sequence>
>      <element name="name" nillable="true" type="xsd:string"/>
>     </sequence>
>    </complexType>
>    <complexType name="Master">
>     <sequence>
>      <element name="details" nillable="true"
> type="impl:ArrayOf_tns2_Detail"/>
>     </sequence>
>    </complexType>
>   </schema>
>   <schema targetNamespace="http://webservice.ws1.arregulo.sowatec.com"
> xmlns="http://www.w3.org/2001/XMLSchema">
>    <import namespace="http://commonobjects.ws.arregulo.sowatec.com"/>
>    <import namespace="http://schemas.xmlsoap.org/soap/encoding/"/>
>    <complexType name="ArrayOf_tns2_Detail">
>     <complexContent>
>      <restriction base="soapenc:Array">
>       <attribute ref="soapenc:arrayType" wsdl:arrayType="tns2:Detail[]"/>
>      </restriction>
>     </complexContent>
>    </complexType>
>   </schema>
> </wsdl:types>
>
> Wsdl of Webservice2:
> <wsdl:types>
>   <schema targetNamespace="http://commonobjects.ws.arregulo.sowatec.com"
> xmlns="http://www.w3.org/2001/XMLSchema">
>    <import namespace="http://webservice.ws2.arregulo.sowatec.com"/>
>    <import namespace="http://schemas.xmlsoap.org/soap/encoding/"/>
>    <complexType name="Detail">
>     <sequence>
>      <element name="name" nillable="true" type="xsd:string"/>
>     </sequence>
>    </complexType>
>    <complexType name="Master">
>     <sequence>
>      <element name="details" nillable="true"
> type="impl:ArrayOf_tns2_Detail"/>
>     </sequence>
>    </complexType>
>   </schema>
>   <schema targetNamespace="http://webservice.ws2.arregulo.sowatec.com"
> xmlns="http://www.w3.org/2001/XMLSchema">
>    <import namespace="http://commonobjects.ws.arregulo.sowatec.com"/>
>    <import namespace="http://schemas.xmlsoap.org/soap/encoding/"/>
>    <complexType name="ArrayOf_tns2_Detail">
>     <complexContent>
>      <restriction base="soapenc:Array">
>       <attribute ref="soapenc:arrayType" wsdl:arrayType="tns2:Detail[]"/>
>      </restriction>
>     </complexContent>
>    </complexType>
>   </schema>
> </wsdl:types>
>
> Thanks,
> Lukas
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-user-help@ws.apache.org
>
>