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 Alick Buckley <Al...@lansa.com.au> on 2006/02/27 02:45:47 UTC

RE: serialization problem in axis 1.3 with bean that includes an array of strings

Hi Jared,

I have got similar problems returning arrays using the Wrapped style, I have
solved most of them.

I still have an Apache Axis 1.3 Agent deserializing a bean array within a
bean problem.

My run time environment is different to most, I use Axis in a standalone
mode, no HTTP server, no deployment, etc..

If you are using the Java2WSDL -y WRAPPED on your own created bean, you need
to add your own Apache MetaData methods to these beans.

Use the Java2WSDL -d option to generate the bean helper code to see how the
meta data methods are created.

Then add your own meta data methods to your bean to assist the AxisServer in
serializing your bean.

I have found that for RPC/Encoded these meta data methods are not needed.



-----Original Message-----
From: Jared Betteridge [mailto:jared@betteridge.us]
Sent: Monday, 27 February 2006 11:23 AM
To: axis-user@ws.apache.org
Subject: serialization problem in axis 1.3 with bean that includes an
array of strings


Hi,

I'm using the axis 1.3 java2wsdl tool (with -y WRAPPED) to create a wsdl
from an existing java class which has a method that returns a bean
object that contains an array of strings. My client is written in gsoap
(2.7.6e), and the problem I am having is that my gsoap client is unable
to deserialize the array inside the returned bean object.  The reason is
that the name of the XML elements for the strings inside the array do
not match what the WSDL specifies.

Here is a snippet from my wsdl showing the response to an "orderMeal"
method that returns a Meal bean object containing an array of strings:

   <element name="orderMealResponse">
    <complexType>
     <sequence>
      <element name="orderMealReturn" type="impl:Meal"/>
     </sequence>
    </complexType>
   </element>

   <complexType name="Meal">
    <sequence>
     <element name="appetizers" nillable="true"
type="impl:ArrayOf_xsd_string"/>
     <element name="mainCourse" nillable="true" type="xsd:string"/>
    </sequence>
   </complexType>

   <complexType name="ArrayOf_xsd_string">
    <sequence>
     <element maxOccurs="unbounded" minOccurs="0" name="item"
type="xsd:string"/>
    </sequence>
   </complexType>


The body of an actual SOAP response that my gsoap client receives is:

 <soapenv:Body>
  <orderMealResponse xmlns="urn:Tarray">
   <orderMealReturn>
    <appetizers>
     <appetizers>Chips</appetizers>
     <appetizers>Salsa</appetizers>
    </appetizers>
    <mainCourse>Pizza</mainCourse>
   </orderMealReturn>
  </orderMealResponse>
 </soapenv:Body>

My gsoap client does not like the fact that the name of the XML element
for the string array members is "appetizers".  According to the WSDL
these array members should be named "item".  If I intercept the SOAP
response using WebScarab and change the array part of the response to  be:

    <appetizers>
     <item>Chips</item>
     <item>Salsa</item>
    </appetizers>

then my gsoap client is happy and everything works.  So why isn't axis
naming these array elements "item" as specified in the WSDL?  Is this a
bug in axis? How can I get my gsoap client to work with this axis web
service?

Thanks!

Jared