I had come to realize (perhaps mistakenly) that I needed to use a custom serializer/deserializer for a complex type that had another JavaBean complex type as an element inside it. You see, when my test Axis client was querying the server, it was generating a fault with a stackTrace that began:
org.xml.sax.SAXException: SimpleDeserializer encountered a child element, which is NOT expected, in something it was trying to deserialize.
at org.apache.axis.encoding.ser.SimpleDeserializer.onStartChild(SimpleDeserializer.java:187)

So I proceeded to replace BeanSerializer/BeanDeserializer with custom serialization. Here's the updated typeMapping in server-config.wsdd:
<typeMapping
deserializer="foo.bar.axis.SomethingDeserializerFactory" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"; qname="ns40:Something"
serializer="foo.bar.axis.SomethingSerializerFactory" type="java:foo.bar.Something" xmlns:ns40="urn:bar.foo" />

As you can see, besides the SomethingSerializer and SomethingDeserializer classes, there is a factory class for each.

Now for a simple test, I have my client call:
Something addSomething(String data)

The call appears to have been put together correctly on the client side. That includes registering the type mapping. The call reaches the server and, as far as I can tell, server execution proceeds as follows:
1. Calls the SomethingDeserializerFactory constructor.
2. Throws the same exception I encountered earlier with the default serialization. "SimpleDeserializer encountered a child element,..."

This fault occurs BEFORE:
* The factory can return a new SomethingDeserializer through its getDeserializerAs(String mechanismType).
* My application code -- namely addSomething() itself -- can be reached.

Perhaps someone can offer a working example of how to nest inside a complex type what is essentially another complex type.


Reply via email to