users@jax-rpc.java.net

Re: DII and HashMap

From: kathy walsh <Kathleen.Walsh_at_Sun.COM>
Date: Wed, 11 Aug 2004 12:05:10 -0400

Herz-
This level of complexity is highly discouraged with the Call API-

you have registered a serilaizer for the hashMap and you also need to
register
a serializer for the mapEntry and map itself- It is also best to also set
the class when setting the parameters and the return type on the call
object.

The call api is meant for use with very simple types and use with
collections
may not suceed.

Herz.S_at_zdf.de wrote:

>Hi,
>
>I deployed a webservice that returns a HashMap.
>It is working with Static Stub and Dynamic Proxy Clients, but I don't know
>how to register the neccessary de-/serializers in my client.
>I only get this error message:
>unexpected element type:
>expected={http://java.sun.com/jax-rpc-ri/internal}hashMap,
>actual={http://java.sun.com/jax-rpc-ri/internal}mapEntry
>
>Can somebody show me my missing entries?
>
>Regards
>
>
>This is part of the Client:
>----------------------------------------------------------------------------
>---------------------
>String NS_NS2 = "http://java.sun.com/jax-rpc-ri/internal";
>QName QNAME_TYPE_HASHMAP = new QName(NS_NS2, "hashMap");
>nameSpaceUri = //"http://helloworld.myserver.de/wsdl/HelloWorld";
>String[] params = { "Duke!" };
>...
>serializer1 = new
>de.myserver.helloworld.soap.HelloIF_useStringGetHashMap_ResponseStruct_SOAPS
>erializer(QNAME_TYPE_HASHMAP, SerializerConstants.DONT_ENCODE_TYPE,
>SerializerConstants.NULLABLE, SOAPConstants.NS_SOAP_ENCODING);
>serializer1 = new
>ReferenceableSerializerImpl(SerializerConstants.DONT_SERIALIZE_AS_REF,
>serializer1);
>mapping.register(de.myserver.helloworld.soap.HelloIF_useStringGetHashMap_Res
>ponseStruct_SOAPSerializer.class, QNAME_TYPE_HASHMAP, new
>SingletonSerializerFactory(serializer1), new
>SingletonDeserializerFactory((Deserializer)serializer1));
>...
>call.setOperationName(new QName(nameSpaceUri, "useStringGetHashMap"));
>call.setReturnType(QNAME_TYPE_HASHMAP);
>call.addParameter("String_1", QNAME_TYPE_STRING, ParameterMode.IN);
>HashMap map = (HashMap) call.invoke(params);
>----------------------------------------------------------------------------
>---------------------
>
>This is part of the WSDL:
>----------------------------------------------------------------------------
>---------------------
>- <complexType name="hashMap">
>- <complexContent>
>- <extension base="tns:map">
> <sequence />
> </extension>
> </complexContent>
> </complexType>
>- <complexType name="map">
>- <complexContent>
>- <restriction base="soap-enc:Array">
> <attribute ref="soap-enc:arrayType" wsdl:arrayType="tns:mapEntry[]" />
> </restriction>
> </complexContent>
> </complexType>
>- <complexType name="mapEntry">
>- <sequence>
> <element name="key" type="anyType" />
> <element name="value" type="anyType" />
> </sequence>
> </complexType>
>----------------------------------------------------------------------------
>---------------------
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: users-unsubscribe_at_jax-rpc.dev.java.net
>For additional commands, e-mail: users-help_at_jax-rpc.dev.java.net
>
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe_at_jax-rpc.dev.java.net
For additional commands, e-mail: users-help_at_jax-rpc.dev.java.net