Forums Register Login

HashMap transmission thru Apache SOAP

+Pie Number of slices to send: Send
Hi,
I need to call a method in service which returns HashMap containing key,value pairs. Though I'm able to transmit the HashMap from service to client but when it reaches the client, the HashMap object doesn't contain any values (it is returned empty) I dont know why it is so ? I have checked the service method which is being called, before returning it is printing on the console what its returning, so I assume problem is not with the server(service). I'm using the folowing code to receive HashMap at the client side :
SOAPMappingRegistry smr = new SOAPMappingRegistry();

BeanSerializer bsr = new BeanSerializer();
QName qn = new QName("urn:serviceName", "java.util.HashMap");

smr.mapTypes(Constants.NS_URI_SOAP_ENC, qn, java.util.HashMap.class, bsr, bsr);
call.setSOAPMappingRegistry(smr);
Response resp = null;
try {
resp = call.invoke(serviceURLInstance, "");
} catch(Exception e)
{ System.out.println("Exception ooccured in SOAPClient : "+e);
}
if ( resp.generatedFault() )
{
Fault fault = resp.getFault();
System.out.println("The call failed: ");
System.out.println("Fault Code = " + fault.getFaultCode());
System.out.println("Fault String = " + fault.getFaultString());
objReturn = (Object) "Fault";
}
else
{
System.out.println("success : "+ resp.getReturnValue().getValue());
return resp.getReturnValue().getValue();
}
Someone pls. help me. !!!
[ August 16, 2002: Message edited by: Sam Cala ]
+Pie Number of slices to send: Send
My guess is the beans serializer isn't going to work since the HashMap doesn't conform to the Java Beans spec. Try using a HashTable instead and it should work using the HashtableSerializer. See Bong's article on type mapping for details.
Kyle
+Pie Number of slices to send: Send
Is that code actually building and returning a HashMap? Does it have the expected number of entries?
Bill
+Pie Number of slices to send: Send
Hi Kyle, There is no way I can make the service return Hashtable since I'm connecting to some other firm's service & calling a method of that service so its not in my hands !! I need some way to get the HashMap supported.
Yes William, HashMap object is being returned but when it reaches the client, it doesn't have any entries. ITS EMPTY.
Pls. help !
+Pie Number of slices to send: Send
I don't understand -- so the other firm has already implemented a web service that uses a Hashmap? If so, do they have an example of making this work (it sounds like THEIR problem, not yours...). Have you hooked up a SOAP trace tool (like the one in Apache SOAP, e.g. TcpTunnelGui, or Bill's tool) to see if there is anything being transmitted (it's not enough to see if the server is producing a Hashmap -- you have to find out if anything is being transmitted in the HTTP).
Or are you implementing a web service on top of an existing API? If so, write a wrapper layer to convert one to the other.
Kyle
[ August 18, 2002: Message edited by: Kyle Brown ]
[ August 18, 2002: Message edited by: Kyle Brown ]
A magnificient life is loaded with tough challenges. En garde tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 3289 times.
Similar Threads
internal method call.getEnvelopeString() fails. unable to identify cause of failure
Client/Server passing objects
problem with SOAP
Axis SOAP return value deserialization
No Deserializer found to deserialize
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 18, 2024 22:07:09.