axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Lyndon Tiu <>
Subject HashMap of HashMaps
Date Tue, 23 Nov 2004 22:03:12 GMT

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

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=""  xmlns="">
<complexType name="mapItem">
    <element name="key" nillable="true" type="xsd:string" /> 
    <element name="value" nillable="true" type="xsd:string" /> 
<complexType name="Map">
      <element maxOccurs="unbounded" minOccurs="0" name="item" type="apachesoap:mapItem"
<schema targetNamespace="" xmlns="">
  <complexType name="ExternalDataWrapper">
      <element name="data" nillable="true" type="apachesoap:Map" /> 

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 .....>
    <getDataResponse xmlns="my.namespace">
      <getDataReturn xmlns="">
          <item xmlns:soapenc="" xmlns:nsl="">

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

View raw message