Hello,


I have a custom object I am trying to pass across the wire using AXIS wrapped 
style document-literal service.



The complex object contains a HashMap of HashMaps (that is, the values of the 
HashMap, are HashMaps themselves).  For reference, I have called this complex 
object "ExternalDataWrapper".



I have used the Java2WSDL tool to generate the WSDL for this class by supplying 
the Interface.  Of course, the Interface does not specify that the HashMap's 
values will contain HashMaps, so it seems that the WSDL generated declares that 
the "type" of the value components of my HashMap will contain an "xsd:string".  
A portion of the WSDL follows:



<schema targetNamespace="http://xml.apache.org/xml-soap";  
xmlns="http://www.w3.org/2001/XMLSchema";>

<complexType name="mapItem">

  <sequence>

    <element name="key" nillable="true" type="xsd:string" /> 

    <element name="value" nillable="true" type="xsd:string" /> 

  </sequence>

</complexType>

<complexType name="Map">

    <sequence>

      <element maxOccurs="unbounded" minOccurs="0" name="item" 
type="apachesoap:mapItem" /> 

    </sequence>

  </complexType>

</schema>

<schema targetNamespace="http://beans.xdb.geocortex.net"; 
xmlns="http://www.w3.org/2001/XMLSchema";>

  <complexType name="ExternalDataWrapper">

    <sequence>

      <element name="data" nillable="true" type="apachesoap:Map" /> 

    </sequence>

  </complexType>

.

.

.



I then used the WSDL2Java tool to generate the client stubs, server skeletons 
and bindings, and the .wsdd files.  When I make a request to my webservice 
(which should return my complex object), I construct the HashMap of HashMaps in 
the Web Service implementation class.  The response is serialized correctly as 
follows:

<soapenv:Envelope .....>

  <soapenv:Body>

    <getDataResponse xmlns="my.namespace">

      <getDataReturn xmlns="">

        <data>

          <item xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"; 
xmlns:nsl="http://xml.apache.org/xml-soap";>

            <key>123</key>

            <value>

              <item>

                 <key>OWNER</key>

                 <value>Miller</value>

              </item>

              <item>

                 <key>AGE</key>

                 <value>42</value>

              </item>

              .

              .

            </value>

          </item>

          <item>

            <key>456</key>

            <value>

               <item>

                .

                .

                .

         </data>

       </getDataReturn>

     </getDataResponse>

  </soapenv:Body>

</soapenv:Envelope>    





The problem is, that the client side does not seem to be able to deserialize my 
ojbect correctly.  Perhaps it is expecting a string as the values of the 
HashMap as opposed to HashMaps.



It is giving me this error:

org.xml.sax.SAXException: SimpleDeserializer encountered a child element, which 
is NOT expected, in something it was trying to deserialize.



My question is: Why can this object be seeminly serialized correctly if it can 
not be deserialized?  

Is deserializing multidimentional HashMaps a limitation of the Axis 
deserializers?



Any suggestions would be appreciated.



Thanks for your time.







--

Lyndon Tiu


Reply via email to