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 Dominik <co...@o2.pl> on 2005/04/27 14:30:44 UTC

WRAPPED, arrays and null

Hi,
I converted my application from RPC to WRAPPED model, 
but now I've problems with arrays:

when server returns empty array, client receives null instead of empty array,
is there possible way to change this behavior?

server sends: ClassA[] {} 
client receives: null

why? in rpc model it worked fine, how can I fix this problem?

tools: Axis RC3, java2wsdl, wsdl2java, both client and server are written in java.

Are there other known incopatibilities beetwen those two models (RPC and WRAPPED) ?

Dominik

Re: WRAPPED, arrays and null

Posted by Dominik <co...@o2.pl>.
My wsdl is created from java definition (java2wsdl), 
I think changing wsdl definition (for each array result) everytime 
wsdl is generated is bit time consuming...

Is it possible to enforce java2wsdl to generate proper WSDL ?
or to make Axis to handle array results properly?

Thank You Anne, :-)
Dominik

----- Original Message ----- 
From: "Anne Thomas Manes" <at...@gmail.com>
To: <ax...@ws.apache.org>
Sent: Wednesday, April 27, 2005 8:03 PM
Subject: Re: WRAPPED, arrays and null


The WSDL looks good. I think this is caused by Axis's preference to
return nulls rather than empty elements. You might try modifying your
array definition to this:

  <element name="getArrayResponse">
   <complexType>
    <sequence>
     <element name="getArrayReturn" type="xsd:string"
        minOccurs="0" maxOccurs="unbounded" nillable="false"/>
    </sequence>
   </complexType>
  </element>

Anne


Re: WRAPPED, arrays and null

Posted by Anne Thomas Manes <at...@gmail.com>.
The WSDL looks good. I think this is caused by Axis's preference to
return nulls rather than empty elements. You might try modifying your
array definition to this:

  <element name="getArrayResponse">
   <complexType>
    <sequence>
     <element name="getArrayReturn" type="xsd:string"
        minOccurs="0" maxOccurs="unbounded" nillable="false"/>
    </sequence>
   </complexType>
  </element>

Anne

On 4/27/05, Dominik <co...@o2.pl> wrote:
> Thanks for article,
> 
> I just create WSDL with java2wsdl  and --style WRAPPED
> 
> my method signature:
> public String[] getArray(C c);
> 
> Here are parts from automatically generated WSDL file
> 
> ...
> 
>    <element name="getArray">
>     <complexType>
>      <sequence>
>       <element name="c" type="tns3:C"/>
>      </sequence>
>     </complexType>
>    </element>
> 
> ...
> 
>    <element name="getArrayResponse">
>     <complexType>
>      <sequence>
>       <element name="getArrayReturn" type="xsd:string"
> maxOccurs="unbounded"/>
>      </sequence>
>     </complexType>
>    </element>
> 
> ...
> 
>    <wsdl:message name="getArrayRequest">
> 
>       <wsdl:part name="parameters" element="impl:getArray"/>
> 
>    </wsdl:message>
> ...
> 
>    <wsdl:message name="getArrayResponse">
> 
>       <wsdl:part name="parameters" element="impl:getArrayResponse"/>
> 
>    </wsdl:message>
> 
> ...
> 
>    <wsdl:operation name="getArray">
>       <wsdl:input name="getArrayRequest" message="impl:getArrayRequest"/>
>       <wsdl:output name="getArrayResponse" message="impl:getArrayResponse"/>
>    </wsdl:operation>
> 
> ...
> 
>       <wsdl:operation name="getArray">
>          <wsdlsoap:operation soapAction=""/>
>          <wsdl:input name="getArrayRequest">
>             <wsdlsoap:body use="literal"/>
>          </wsdl:input>
>          <wsdl:output name="getArrayResponse">
>             <wsdlsoap:body use="literal"/>
>          </wsdl:output>
>       </wsdl:operation>
> ...
> 
> 
> ----- Original Message -----
> From: "Anne Thomas Manes" <at...@gmail.com>
> To: <ax...@ws.apache.org>
> Sent: Wednesday, April 27, 2005 3:11 PM
> Subject: Re: WRAPPED, arrays and null
> 
> How did you define your array? (please send us your WSDL)
> 
> Please also see the Wiki page on arrays:
> http://wiki.apache.org/ws/DotNetInteropArrays
> 
> Anne
> 
>

Re: WRAPPED, arrays and null

Posted by Dominik <co...@o2.pl>.
Thanks for article,

I just create WSDL with java2wsdl  and --style WRAPPED

my method signature:
public String[] getArray(C c);

Here are parts from automatically generated WSDL file


...

   <element name="getArray">
    <complexType>
     <sequence>
      <element name="c" type="tns3:C"/>
     </sequence>
    </complexType>
   </element>

...

   <element name="getArrayResponse">
    <complexType>
     <sequence>
      <element name="getArrayReturn" type="xsd:string" 
maxOccurs="unbounded"/>
     </sequence>
    </complexType>
   </element>

...

   <wsdl:message name="getArrayRequest">

      <wsdl:part name="parameters" element="impl:getArray"/>

   </wsdl:message>
...

   <wsdl:message name="getArrayResponse">

      <wsdl:part name="parameters" element="impl:getArrayResponse"/>

   </wsdl:message>

...

   <wsdl:operation name="getArray">
      <wsdl:input name="getArrayRequest" message="impl:getArrayRequest"/>
      <wsdl:output name="getArrayResponse" message="impl:getArrayResponse"/>
   </wsdl:operation>

...

      <wsdl:operation name="getArray">
         <wsdlsoap:operation soapAction=""/>
         <wsdl:input name="getArrayRequest">
            <wsdlsoap:body use="literal"/>
         </wsdl:input>
         <wsdl:output name="getArrayResponse">
            <wsdlsoap:body use="literal"/>
         </wsdl:output>
      </wsdl:operation>
...


----- Original Message ----- 
From: "Anne Thomas Manes" <at...@gmail.com>
To: <ax...@ws.apache.org>
Sent: Wednesday, April 27, 2005 3:11 PM
Subject: Re: WRAPPED, arrays and null


How did you define your array? (please send us your WSDL)

Please also see the Wiki page on arrays:
http://wiki.apache.org/ws/DotNetInteropArrays

Anne



Re: WRAPPED, arrays and null

Posted by Anne Thomas Manes <at...@gmail.com>.
How did you define your array? (please send us your WSDL)

Please also see the Wiki page on arrays:
http://wiki.apache.org/ws/DotNetInteropArrays

Anne

On 4/27/05, Dominik <co...@o2.pl> wrote:
>  
> Hi, 
> I converted my application from RPC to WRAPPED model, 
> but now I've problems with arrays: 
>   
> when server returns empty array, client receives null instead of empty
> array, 
> is there possible way to change this behavior? 
>   
> server sends: ClassA[] {} 
> client receives: null 
>   
> why? in rpc model it worked fine, how can I fix this problem? 
>   
> tools: Axis RC3, java2wsdl, wsdl2java, both client and server are written in
> java. 
>   
> Are there other known incopatibilities beetwen those two models (RPC and
> WRAPPED) ? 
> 
> Dominik
>