"org.xml.sax.SAXException: SimpleDeserializer encountered a child element, which is NOT expected, in something it was trying to deserialize."
For a while, I thought this had to do with the complex type the offending method was returning. After some prolonged debugging, I realized my special type had nothing to do with this. As a simple test, I tried adding another method to my web service interface:
public void sendString(String string)
Remarkably, this produced the same error.
Finally, I realized the problem was the result of a stupid error in my Axis client. I was registering type mappings for ALL types, wrongly assuming that all types were my custom types. Obviously, standard types like strings don't need their type mappings registered. At the same time, I was erroneously assigning strings a bean (de)serializer.
Hoping someone else can learn from my cluelessness.
At 12:55 03.12.02 -0800, I wrote:
Tom, thanks for taking a stab at this. I'll check those test cases you suggested. TCPMon indicates my SOAP request is using the correct namespace, "urn:bar.foo". But the request doesn't have to contain the complex data type, Something; only the response does.
For comparison's sake, I have a non-nesting type. Call it Safething. It has a corresponding method, addSafething(). This works fine. What's interesting is that Axis is obviously trying to deserialize Something or Safething -- even though *thing is just a return type (and not an input) -- before it (Axis) summons my application code. Why does Axis try to deserialize the return type at the outset even though obviously no data of that type is going to be contained in the request?
What's also interesting is that the only apparent suspects are the operation specification for addSomething() and the typeMapping for Something, both in server-config.wsdd. I don't seem to have introduced much that could go wrong since the going-wrong is taking place before my own code is reached.
=============================================
RELEVANT PASSAGES FROM SERVER-CONFIG.WSDD:
<operation name="addSomething" qname="ns11:addSomething"
____returnQName="addSomethingReturn" returnType="ns11:Something"
____xmlns:ns11="urn:bar.foo">
____<parameter name="in0" type="xsd:string"
________xmlns:xsd="http://www.w3.org/2001/XMLSchema" />
____<fault class="foo.bar.BarException" qname="ns11:fault"
________type="ns11:BarException" />
</operation>
<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" />
BODY OF THE SOAP REQUEST:
<ns1:addSomething __soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
__xmlns:ns1="urn:bar.foo">
____<in0 xsi:type="xsd:string">
________<bytes xsi:type="xsd:base64Binary">Y2xlYW4gdnMuIGRpcnR5</bytes>
____</in0>
</ns1:addSomething>
