Hi,
I am implementing a Web Service client and coming across Serialization
problem. In Web Service there is a method with following signature :
OrderResponse order (OrderRequest request)
OrderRequest and OrderResponse both are user defined defined complex
types implemented as JavaBeans. Skeleton of OrderRequest class is :
package com.aol.fog.fr.objects;
public class OrderRequest extends OrderRequestCommon {
private Address adsl_address = null;
/....
../
public Address getAdsl_address() {
return adsl_address;
}
public void setAdsl_address(Address adsl_address) {
this.adsl_address = adsl_address;
}
Address again is a Java class implemented as JavaBean with following
code :
package com.aol.fog.fr.objects;
public class Address {
private String title;
/...
../
public Address() {
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
/...
}
I use wscompile to generate stub classes for the webservice in package
: com.aol.fog.fr.objects
In the client code :
Address adslAddress = new Address();
adslAddress.setTitle("test");
OrderRequest request = new OrderRequest();
request.setAdsl_address (adslAddress);
//Create proxy for web service etc
try {
OrderResponse response = myProxy.order(request);
} catch (Exception exc) {
System.out.println ("Error while calling order method on FOG
Web Service");
System.out.println(exc.getMessage());
exc.printStackTrace();
}
The call throws following exception :
serialization error:
java.lang.IllegalArgumentException: object is not
an instance of declaring class
serialization error: java.lang.IllegalArgumentException: object is not
an instance of declaring class
at
com.sun.xml.rpc.encoding.ObjectSerializerBase.serialize(ObjectSerializerBase.java
:113)
at
com.sun.xml.rpc.encoding.ReferenceableSerializerImpl.serializeInstance(Referencea
bleSerializerImpl.java:194)
at
com.sun.xml.rpc.encoding.SOAPSerializationContext.serializeMultiRefObjects(SOAPSe
rializationContext.java:94)
at
com.sun.xml.rpc.client.StreamingSender._writeRequest(StreamingSender.java:477)
at
com.sun.xml.rpc.client.StreamingSender._send(StreamingSender.java:59)
at
com.sun.xml.rpc.client.dii.CallInvokerImpl.doInvoke(CallInvokerImpl.java:61)
at
com.sun.xml.rpc.client.dii.BasicCall.invoke(BasicCall.java:353)
at
com.sun.xml.rpc.client.dii.CallInvocationHandler.doCall(CallInvocationHandler.jav
a:99)
at
com.sun.xml.rpc.client.dii.CallInvocationHandler.invoke(CallInvocationHandler.jav
a:71)
at $Proxy0.order(Unknown Source)
at FogWSDynClient.main(FogWSDynClient.java:133)
CAUSE:
java.lang.IllegalArgumentException: object is not an instance of
declaring class
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java
:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at
com.sun.xml.rpc.encoding.ValueTypeSerializer$1.get(ValueTypeSerializer.java:84)
at
com.sun.xml.rpc.encoding.GenericObjectSerializer.doSerializeInstance(GenericObjec
tSerializer.java:163)
at
com.sun.xml.rpc.encoding.ObjectSerializerBase.serialize(ObjectSerializerBase.java
:102)
at
com.sun.xml.rpc.encoding.ReferenceableSerializerImpl.serializeInstance(Referencea
bleSerializerImpl.java:194)
at
com.sun.xml.rpc.encoding.SOAPSerializationContext.serializeMultiRefObjects(SOAPSe
rializationContext.java:94)
at
com.sun.xml.rpc.client.StreamingSender._writeRequest(StreamingSender.java:477)
at
com.sun.xml.rpc.client.StreamingSender._send(StreamingSender.java:59)
at
com.sun.xml.rpc.client.dii.CallInvokerImpl.doInvoke(CallInvokerImpl.java:61)
at
com.sun.xml.rpc.client.dii.BasicCall.invoke(BasicCall.java:353)
at
com.sun.xml.rpc.client.dii.CallInvocationHandler.doCall(CallInvocationHandler.jav
a:99)
at
com.sun.xml.rpc.client.dii.CallInvocationHandler.invoke(CallInvocationHandler.jav
a:71)
at $Proxy0.order(Unknown Source)
at FogWSDynClient.main(FogWSDynClient.java:133)
CAUSE:
java.lang.IllegalArgumentException: object is not an instance of
declaring class
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java
:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at
com.sun.xml.rpc.encoding.ValueTypeSerializer$1.get(ValueTypeSerializer.java:84)
at
com.sun.xml.rpc.encoding.GenericObjectSerializer.doSerializeInstance(GenericObjec
tSerializer.java:163)
at
com.sun.xml.rpc.encoding.ObjectSerializerBase.serialize(ObjectSerializerBase.java
:102)
at
com.sun.xml.rpc.encoding.ReferenceableSerializerImpl.serializeInstance(Referencea
bleSerializerImpl.java:194)
at
com.sun.xml.rpc.encoding.SOAPSerializationContext.serializeMultiRefObjects(SOAPSe
rializationContext.java:94)
at
com.sun.xml.rpc.client.StreamingSender._writeRequest(StreamingSender.java:477)
at
com.sun.xml.rpc.client.StreamingSender._send(StreamingSender.java:59)
at
com.sun.xml.rpc.client.dii.CallInvokerImpl.doInvoke(CallInvokerImpl.java:61)
at
com.sun.xml.rpc.client.dii.BasicCall.invoke(BasicCall.java:353)
at
com.sun.xml.rpc.client.dii.CallInvocationHandler.doCall(CallInvocationHandler.jav
a:99)
at
com.sun.xml.rpc.client.dii.CallInvocationHandler.invoke(CallInvocationHandler.jav
a:71)
at $Proxy0.order(Unknown Source)
at FogWSDynClient.main(FogWSDynClient.java:133)
What is the reason for this exception ? Any help and suggestions
greatly appreciated.
Regards
Narinder
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@jax-rpc.dev.java.net
For additional commands, e-mail: users-help@jax-rpc.dev.java.net