I've been pulling my hair out over this one for a few weeks. I cannot seem to keep my custom Serializers from creating redundant top level elements in the SOAP body. I'm not sure if it is a problem with the hand-off from the BeanSerializer to my CastorSerializer of if I'm missing something, conceptually, in my CastorSerializer.
I've attached a small project which examplifies this issue. (3rd party jars removed) I opted for this approach instead of posting a dozen or so files to this email. Ant script creates a war deployable to a local JBoss or Tomcat instance with a simple JUNIT testcase.
The core of my problem is that regardless of whether I say in my WSDL:
<element name="in0" type="tns1:A"/>
or
<element name="in0" type="impl:In0"/>
<complexType name="In0">
<sequence>
<element name="a" type="tns1:A"/>
</sequence>
</complexType>
<complexType name="In0">
<sequence>
<element name="a" type="tns1:A"/>
</sequence>
</complexType>
where A is defined by:
<complexType name="B">
<sequence>
<element name="myString" nillable="true" type="xsd:string"/>
</sequence>
</complexType>
<complexType name="A">
<sequence>
<element name="b" nillable="true" type="tns1:B"/>
</sequence>
</complexType>
<sequence>
<element name="myString" nillable="true" type="xsd:string"/>
</sequence>
</complexType>
<complexType name="A">
<sequence>
<element name="b" nillable="true" type="tns1:B"/>
</sequence>
</complexType>
and my WSDDs contain:
<typeMapping
xmlns:ns="http://dto.maring.org"
qname="ns:B"
type="java:org.maring.dto.B"
serializer="org.maring.ser.CastorSerializerFactory"
deserializer="org.maring.ser.CastorDeserializerFactory"
encodingStyle=""
/>
<typeMapping
xmlns:ns="http://dto.maring.org"
qname="ns:A"
type="java:org.maring.dto.A"
serializer="org.maring.ser.CastorSerializerFactory"
deserializer="org.maring.ser.CastorDeserializerFactory"
encodingStyle=""
/>
xmlns:ns="http://dto.maring.org"
qname="ns:B"
type="java:org.maring.dto.B"
serializer="org.maring.ser.CastorSerializerFactory"
deserializer="org.maring.ser.CastorDeserializerFactory"
encodingStyle=""
/>
<typeMapping
xmlns:ns="http://dto.maring.org"
qname="ns:A"
type="java:org.maring.dto.A"
serializer="org.maring.ser.CastorSerializerFactory"
deserializer="org.maring.ser.CastorDeserializerFactory"
encodingStyle=""
/>
The soap body will end up either looking like this:
<soapenv:Body>
<in0 xmlns="http://ws.maring.org">
<in0 xmlns="http://ws.maring.org">
<a>
<b>
<myString>Hello World</myString>
</b>
</a>
</in0>
</soapenv:Body>
<b>
<myString>Hello World</myString>
</b>
</a>
</in0>
</soapenv:Body>
with complaints about: "Invalid element in org.maring.dto.A - a" since in0 is of complexType A
or this:
<a>
<b>
<myString>Hello World</myString>
</b>
</a>
</a>
</in0>
</soapenv:Body>
<b>
<myString>Hello World</myString>
</b>
</a>
</a>
</in0>
</soapenv:Body>
with complaints of the form: "Invalid element in org.maring.dto.A - a"
Any thoughts would be VASTLY appriciated!
Cheers.
Steve Maring
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
WSTest.zip
Description: WSTest.zip
