Re:R: HashMap of HashMaps

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Re:R: HashMap of HashMaps

Angelo Immediata
Hi; why don't you use document instead of Hashmaps? In this way you can pass an XML rapresentation of your "dati" and then from the XML you can create your Java-structure.

---------- Initial Header -----------

From      : "Claudia Mavilio" [hidden email]
To          : [hidden email]
Cc          :
Date      : Thu, 5 May 2005 11:50:21 +0200
Subject : R: HashMap of HashMaps

>
> Hello Everybody,
>
> I have the same Lyndon's problem, because I deploy a java webservice
> that incapsulate response data into a Hashmap (whose name is "dati",
> please see below) using a wsdd file.
> The kind of response data into the Hashmap is of type "Costruttore" and
> doesn't appear in wsdl file, so the generation of stub and
> deserialization classes fails.
> Follow a snippet of mi wsdl file and a copy of the wsdd file.
> Thanks in advance for any help!!!
>
> Claudia
>
> ----------------------------------------------------------------
> FILE WSDD:
>
> <service name="Costruttori" provider="java:RPC">
>   <parameter name="className"
> value="it.seceti.coc.service.ws.jaxrpc.CostruttoriJaxRpc"/>
>   <parameter name="allowedMethods" value="*"/>
> <beanMapping qname="coc:BaseObject" xmlns:coc="urn:coc"
> languageSpecificType="java:org.appfuse.model.BaseObject"/>
> <beanMapping qname="coc:Costruttore" xmlns:coc="urn:coc"
> languageSpecificType="java:it.seceti.coc.model.Costruttore"/>
> <beanMapping qname="coc:IDOperatore" xmlns:coc="urn:coc"
> languageSpecificType="java:it.seceti.coc.model.IDOperatore"/>
> <beanMapping qname="coc:Esito" xmlns:coc="urn:coc"
> languageSpecificType="java:it.seceti.coc.model.esito.Esito"/>
> <beanMapping qname="coc:RisultatoOperazione" xmlns:coc="urn:coc"
> languageSpecificType="java:it.seceti.coc.model.esito.RisultatoOperazione
> "/>
> <beanMapping qname="coc:Locale" xmlns:coc="urn:coc"
> languageSpecificType="java:it.seceti.coc.model.esito.Locale"/>
>   <parameter name="wsdlServiceElement" value="CostruttoriService"/>
>   <parameter name="wsdlServicePort" value="Costruttori"/>
>   <parameter name="wsdlPortType" value="Costruttori"/>
>  </service>
> ----------------------------------------------------------------------
> SNIPPET OF WSDL FILE:
>
> .......
> complexType name="Esito">
>
> - <sequence>
>
>   <element name="dati" nillable="true" type="apachesoap:Map" />
>
>   <element name="risultatoOperazione" nillable="true"
> type="tns1:RisultatoOperazione" />
>
>   </sequence>
>
>   </complexType>
>
>   </schema>
>
> ..............
>
> ------------------------------------------------------------------------
> ----
>
>
>
> Subject:    HashMap of HashMaps
> From:       Lyndon Tiu <ltiu () alumni ! sfu ! ca>
> Date:       2004-11-23 22:03:12
> Message-ID: <200411232203.iANM3CO2010215 () rm-rstar ! sfu ! ca>
> [Download message RAW]
>
> 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
>
>
> === Start-of Internet E-mail Confidentiality Footer ===
>
> L'uso non autorizzato di questo messaggio o dei suoi allegati e' vietato e potrebbe costituire reato.
> Se ha ricevuto per errore questo messaggio, La preghiamo di informarci e di distruggerlo immediatamente coi suoi allegati.
> Le dichiarazioni contenute in questo messaggio o nei suoi allegati non impegnano SECETI S.p.A. nei confronti del destinatario o di terzi.
> SECETI S.p.A. non si assume alcuna responsabilita' per eventuali intercettazioni, modifiche o danneggiamenti del presente messaggio.
>
> Any unauthorized use of this e-mail or any of its attachments is prohibited and could constitute an offence.
> If you are not the intended addressee please advise immediately the sender and destroy the message and its attachments.
> The contents of this message shall be understood as neither given nor endorsed by SECETI S.p.A.
> SECETI S.p.A. does not accept liability for corruption, interception or amendment, if any, or the consequences thereof.
>



____________________________________________________________
Navighi a 4 MEGA e i primi 3 mesi sono GRATIS.
Scegli Libero Adsl Flat senza limiti su http://www.libero.it