Posted By:
Anonymous
Posted On:
Monday, October 20, 2003 08:36 AM
I'm stuck with a serious problem. let me go directly to the problem. This is my soap service "urn:server" pubilc A getMessage() { B b = new B(); b.setName("test"); return b; } And here's my client serializer = new BeanSerializer(); QName dataQName = new QName("urn:A","A"); registry.mapTypes(Constants.NS_URI_SOAP_ENC,dataQName,A.class, serializer, serializer); dataQName = new QName("urn:B","B"); registry.mapTypes(Constants.NS_URI_SOAP_ENC,dataQName,B.class, serializer, serializer); Call call = new Call(); call.setSOAPMappingRegistry(reg
More>>
I'm stuck with a serious problem. let me go directly to the problem.
This is my soap service
"urn:server"
pubilc A getMessage()
{
B b = new B();
b.setName("test");
return b;
}
And here's my client
serializer = new BeanSerializer();
QName dataQName = new QName("urn:A","A");
registry.mapTypes(Constants.NS_URI_SOAP_ENC,dataQName,A.class, serializer, serializer);
dataQName = new QName("urn:B","B");
registry.mapTypes(Constants.NS_URI_SOAP_ENC,dataQName,B.class, serializer, serializer);
Call call = new Call();
call.setSOAPMappingRegistry(registry);
call.setTargetObjectURI("urn:server");
call.setMethodName("getMessage");
call.setEncodingStyleURI(Constants.NS_URI_SOAP_ENC);
Response response = call.invoke(url,"");
A a = (A) response.getParameter().getValue();
B b = (B) a;
System.out.println(b.getName());
END....
Now please have a look at A and B
public interface A
{
public String getName();
public void setName();
}
public class B implements A
{
private String name;
public String getName()
{
return this.name;
}
public void setName(String name)
{
this.name = name;
}
}
Now the problem goes like this.....this is not working ;-)
It's giving the following error,
SOAPException: faultCode=SOAP-ENV:Client; msg=Unable to instantiate 'A': A; targetException= java.lang.IllegalArgumentException: Unable to instantiate 'A: A]
at org.apache.soap.rpc.Call.invoke(Call.java:246)
at Test.send(Test.java:69)
at Test.main(Test.java:93)
How can i return interfaces from a SOAP service ?
or what's the solution for this problem. ????
Thanks in advance.
Sreehari.
<<Less