Thanks for the responses so far. By looking at the wrapped tests in the 
tests/wsdl/wrapped2 directory I managed to solve the problemn at least as far 
as the normal Axis Bean Serializer/Deserializer are concerned by changing the 
way my types were defined in the schema.

The Castor example I was following defined all types as <element>s like this:

<xsd:element name="getTestsAsArrayResponse">
  <xsd:complexType name="TestDataArray">
    <xsd:sequence>
      <xsd:element maxOccurs="unbounded" ref="tns2:testData"/>
    </xsd:sequence>
  </xsd:complexType>
</xsd:element>

However, the test case defined types as <complexType>s instead:
<xsd:element name="getTestsAsArrayResponse" type="TestArrayType"/>   
<xsd:complexType name="TestArrayType">
  <xsd:sequence>
    <xsd:element name="testData" type="tns2:testData" maxOccurs="unbounded" 
minOccurs="0" nillable="true" />
  </xsd:sequence>
</xsd:complexType>

When I made this change, the spurious [0,unbounded] element stopped appearing 
in the QName in the Skeleton and Stub classes and the returned SOAP messages 
were valid XML. Now the standard BeanSerializer and Deserializer work for my 
data model. 

However, the Castor ones still don't work in the case of arrays. By placing 
some debug statements in the CastorDeserializer code, I can see that when the 
CastorDeserializer attempts to deserialize the returned message (see below) it 
attempts to use the correct TestData class but it uses the wrong element from 
the message (it uses the "name" element within "ns1:test" instead of 
"ns1:test"). At this point I am stuck because it seems to work fine for 
TestData classes when they are not in arrays. I can't see why the Deserializer 
attempts to use the wrong message element to deserialize arrays.

<?xml version="1.0" encoding="utf-8"?>
<soapenv:Envelope 
  xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"; 
  xmlns:xsd="http://www.w3.org/2001/XMLSchema"; 
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";>
  <soapenv:Body>
    <getTestsAsArrayResponse 
      xmlns="http://www.fortune-cookie.com/schemas/services/timesheet/wsdl";>
      <ns1:test <- deserializer should use this element to deserialize
        xsi:type="testData" 
        
xmlns:ns1="http://www.fortune-cookie.com/schemas/services/timesheet/data";>
        <name xmlns="">test1</name> <- deserializer tries to use this element
      </ns1:test>
      <ns2:test
        xsi:type="testData" 
        
xmlns:ns2="http://www.fortune-cookie.com/schemas/services/timesheet/data";>
        <name xmlns="">test2</name>
      </ns2:test>
    </getTestsAsArrayResponse>
  </soapenv:Body>
</soapenv:Envelope>

Thanks in advance for any help anyone can offer on this issue.

Patrick van Kann




-----Original Message-----
From: James Black [mailto:[EMAIL PROTECTED]
Sent: Thu 31/03/2005 02:53
To: [email protected]
Subject: Re: Is there a bug with Axis webservice methods returning arrays?
 
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Alick Buckley wrote:
> I had a similar problem when testing WRAPPED style.
>  
> I wish I could present more accurate information than "I have noticed
> the same thing"

You may want to see if it is similar to a bug I reported:
http://issues.apache.org/jira/browse/AXIS-1876

- --
Corruptisima republica plurimae leges. [The more corrupt a republic, the
more laws.]
Tacitus from Annals III, 116AD
Blogs: http://jamesruminations.blogspot.com
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.0 (MingW32)

iD8DBQFCS1gEJ/zyYkX46joRAjHFAKCFWxM6gm1Vq+osiB+TIm6M7QyhwwCfbv7X
s3XQIpYY3mc3gmY1fx0Boeo=
=axbS
-----END PGP SIGNATURE-----

<<winmail.dat>>

Reply via email to