You are viewing a plain text version of this content. The canonical link for it is here.
Posted to soap-user@ws.apache.org by Jason Bodnar <ja...@shakabuku.org> on 2002/08/26 18:46:32 UTC

java.lang.ClassCastException (sometimes)

I'm trying to pass an object that is a hash of objects (that fit the bean
format) as a parameter. Sometimes I get the following error:


java.lang.ClassCastException: com.broadq.qcaststation.ModuleManifest
        at org.apache.soap.rpc.RPCMessage.serializeParams(RPCMessage.java:325)
        at org.apache.soap.rpc.RPCMessage.marshall(RPCMessage.java:307)
        at org.apache.soap.Body.marshall(Body.java:145)
        at org.apache.soap.Envelope.marshall(Envelope.java:195)
        at
org.apache.soap.transport.http.SOAPHTTPConnection.send(SOAPHTTPConnection.java:273)
        at org.apache.soap.rpc.Call.invoke(Call.java:248)
        at
com.broadq.qcaststation.UpdateModulesTask.run(UpdateModulesTask.java:76)
        at java.util.TimerThread.mainLoop(Timer.java:432)
        at java.util.TimerThread.run(Timer.java:382)

Other times my application just sits there without ever talking to the SOAP
service.

Here's the code relevant code:

Call call = new Call();
SOAPMappingRegistry smr = new SOAPMappingRegistry();
call.setSOAPMappingRegistry(smr);
HashtableSerializer hashSer = new HashtableSerializer();
BeanSerializer beanSer = new BeanSerializer();
smr.mapTypes(Constants.NS_URI_SOAP_ENC, 
             new QName("urn:BroadQServices", "ModuleManifest"),
	     com.broadq.qcaststation.ModuleManifest.class,
             hashSer, hashSer);
smr.mapTypes(Constants.NS_URI_SOAP_ENC, 
    	     new QName("urn:BroadQServices", "Module"),
	     com.broadq.qcaststation.Module.class,
	     beanSer, beanSer);
call.setTargetObjectURI(OBJECT_URI);
call.setMethodName(METHOD_NAME);
call.setEncodingStyleURI(Constants.NS_URI_SOAP_ENC);
Vector params = new Vector();
params.addElement(manifest);
call.setParams(params);
org.apache.soap.rpc.Response resp = call.invoke(url, ""); 

ModuleManifest extends Hashtable and contains module name, Module pairs.
Module is a simple object that follows the bean get/set format.

Am I missing something or doing something wrong?

--
Jason Bodnar
jason@shakabuku.org
http://www.shakabuku.org