Dear axis users,
I tried to figure out, if Axis' default BeanSerializers/Deserializers are capable of
handling nested SOAP ComplexTypes resp. JavaBeans. I searched the mailinglist archive
and the JAX-RPC spec. without success. If fact, XML Schema allows nested ComplexType
definitions but the JAX-RPC spec. says nothing at all about this issue. So I set up an
example application which is described below to find out myself.
The following question came into my mind after that: Do I need to write my own
CustomBeanSerializers/Deserializers to handle nested ComplexTypes because Axis doesn't
support this or have i made a mistake in my example.
I'd' be thankful, if someone could help me out here.
Thanks in advance,
Steffen
The example:
java2wsdl generates the following wsdl:Type definitions (which seem correct to me)
from two nested JavaBeans. The bean 'Customer' is used as parameter in the
WebService-method 'testMethod'.
<complexType name="Address">
<sequence>
<element name="city" nillable="true" type="xsd:string"/>
<element name="country" nillable="true" type="xsd:string"/>
<element name="street" nillable="true" type="xsd:string"/>
<element name="streetNo" nillable="true" type="xsd:string"/>
<element name="zipCode" nillable="true" type="xsd:string"/>
</sequence>
</complexType>
<complexType name="Customer">
<sequence>
<element name="address" nillable="true" type="tns1:Address"/>
<element name="firstName" nillable="true" type="xsd:string"/>
<element name="lastName" nillable="true" type="xsd:string"/>
</sequence>
</complexType>
The Beans:
public class Address implements java.io.Serializable {
private String country;
private String city;
private String zipCode;
private String street;
private String streetNo;
(...)
}
public class Customer implements java.io.Serializable {
private String firstName;
private String lastName;
private Address address;
(...)
}
After filling the beans and invoking the WebService-method, tcpmon prints out the
following SOAP-request:
(...)
<soapenv:Envelope ... >
<soapenv:Body>
<ns1:testMethod ... >
<ns1:arg0 href="#id0"/>
<ns1:arg1 xsi:type="xsd:string">blah</ns1:arg1>
<ns1:arg2 xsi:type="xsd:string">blubb</ns1:arg2>
</ns1:testMethod>
<multiRef
id="id0"
soapenc:root="0"
soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xsi:type="ns2:Customer"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:ns2="http://testns"
>
<address xsi:type="ns2:Address" xsi:nil="true"/>
<firstName xsi:type="xsd:string">FName</firstName>
<lastName xsi:type="xsd:string">LName</lastName>
</multiRef>
</soapenv:Body>
</soapenv:Envelope>
So i guess, the nested Address has not been serialized. Obviously it can't be
deserialized again by the WebService. Everything works fine with the SimpleType data
within 'Customer'. So it seems to me that the Axis default BeanDeserializer just
processes the first level of a ComplexType value and i have to write my own, if I want
to use nested ComplexTypes. Can this be true, or am I missing anything here?
______________________________________________________________________________
Nachrichten, Musik und Spiele schnell und einfach per Quickstart im
WEB.DE Screensaver - Gratis downloaden: http://screensaver.web.de/?mc=021110