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 Ron Reynolds <Ro...@RonReynolds.com> on 2005/09/28 20:49:28 UTC

array vs object based on namespace use in schema?

is this a known/desired feature of wsdl2java?

given the following WSDL snippet:

  <wsdl:types>
    <xsd:schema
        targetNamespace="urn:example.com/test/data"
        xmlns:tns="urn:example.com/test/data">
      <xsd:include schemaLocation="data.xsd"/>
    </xsd:schema>
  </wsdl:types>

  <wsdl:message name="TestRequest" ><wsdl:part name="request" type="data:ArrayOfLong"/></wsdl:message>
  <wsdl:message name="TestResponse"><wsdl:part name="response" type="data:ArrayOfLong"/></wsdl:message>

  <wsdl:portType name="TestPort">
    <wsdl:operation name="testOp">
      <wsdl:input  message="tns:TestRequest"/>
      <wsdl:output message="tns:TestResponse"/>
    </wsdl:operation>
  </wsdl:portType>

if data.xsd uses
<schema
    xmlns           = "http://www.w3.org/2001/XMLSchema"
    xmlns:tns       = "urn:example.com/test/data"
    targetNamespace = "urn:example.com/test/data">
  <complexType name="ArrayOfLong">
    <sequence>
      <element name="elements" type="long" minOccurs="0" maxOccurs="unbounded"/>
    </sequence>
  </complexType>
</schema>

you get an interface with
    public long[] testOp(long[] request) throws java.rmi.RemoteException;

but if data.xsd uses a namespace for all its sequence element (i.e.,
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
  ...
  <xsd:sequence>...</xsd:sequence>
)
you get
    public ArrayOfLong testOp(ArrayOfLong request) throws java.rmi.RemoteException;

it all depends on whether it's <xsd:sequence> or <sequence>.  is that normal?  does that impact encoding in any way? 
i have other questions regarding encoding vs literal but i'll save those for later emails.

.............ron.




Re: array vs object based on namespace use in schema?

Posted by Ron Reynolds <Ro...@RonReynolds.com>.
appearantly this discrepancy in <xsd:sequence> vs <sequence> produces runtime issues when the Axis server is trying to
find the method to which to map the request (regardless of literal vs encoded) -

basically if you have <xsd:sequence> wsdl2java will generate this:
ArrayOfFoo op(ArrayOfFoo request)...

but at runtime, when hunting for the method to handle the "op" request to, the Axis servlet will go hunting for
Foo[] op(Foo[] request)
instead (and, obviously, not find it).

as i understand things (which is still shakey at this point) it's better to use
<complexType><sequence><element minOccurs maxOccurs type=thingy/></sequence></complexType>

than to use
<complexType><complexContent><restriction base="soapenc:Array"/>...

correct?  this is to address inter-op between different WS providers, right?  seems like there are some intrinsic
rules that need to be followed to keep Axis working with Axis clients as well...

.................ron.


<
> is this a known/desired feature of wsdl2java?
>
> given the following WSDL snippet:
>
>   <wsdl:types>
>     <xsd:schema
>         targetNamespace="urn:example.com/test/data"
>         xmlns:tns="urn:example.com/test/data">
>       <xsd:include schemaLocation="data.xsd"/>
>     </xsd:schema>
>   </wsdl:types>
>
>   <wsdl:message name="TestRequest" ><wsdl:part name="request" type="data:ArrayOfLong"/></wsdl:message>
>   <wsdl:message name="TestResponse"><wsdl:part name="response" type="data:ArrayOfLong"/></wsdl:message>
>
>   <wsdl:portType name="TestPort">
>     <wsdl:operation name="testOp">
>       <wsdl:input  message="tns:TestRequest"/>
>       <wsdl:output message="tns:TestResponse"/>
>     </wsdl:operation>
>   </wsdl:portType>
>
> if data.xsd uses
> <schema
>     xmlns           = "http://www.w3.org/2001/XMLSchema"
>     xmlns:tns       = "urn:example.com/test/data"
>     targetNamespace = "urn:example.com/test/data">
>   <complexType name="ArrayOfLong">
>     <sequence>
>       <element name="elements" type="long" minOccurs="0" maxOccurs="unbounded"/>
>     </sequence>
>   </complexType>
> </schema>
>
> you get an interface with
>     public long[] testOp(long[] request) throws java.rmi.RemoteException;
>
> but if data.xsd uses a namespace for all its sequence element (i.e.,
> <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
>   ...
>   <xsd:sequence>...</xsd:sequence>
> )
> you get
>     public ArrayOfLong testOp(ArrayOfLong request) throws java.rmi.RemoteException;
>
> it all depends on whether it's <xsd:sequence> or <sequence>.  is that normal?  does that impact encoding in any way?
> i have other questions regarding encoding vs literal but i'll save those for later emails.
>
> .............ron.
>
>
>
>