Reply to myself, for people that will have the same troubles : the InnerBean class should be static On May 2, 2005, at 11:02 AM, thomas wrote:
Hello I have no problem for writing Java clients for "normal" beans returned, but, I have a problem with a bean that is an inner class.
So my bean is something like that : package my.package; public class FirstClass { ... //my inner class public class InnerBean { .... } }
Note that FirstClass is also a a webservice class, with a method that will return an instance of InnerBean.
The wsdd :
<deployment name="authentication" xmlns="http://xml.apache.org/axis/wsdd/" xmlns:java="http://xml.apache.org/axis/wsdd/providers/java" xmlns:esis="urn:my.package.FirstClass" > <service name="Authentication" provider="java:RPC"> <parameter name="className" value="my.package.FirstClass" /> <parameter name="allowedMethods" value="*" />
<namespace>urn:my.package.FirstClass</namespace> <beanMapping qname="myNS:FirstClass" languageSpecificType="java:my.package.FirstClass$InnerBean" />
Now the client :
I declare as usual all the stuff, except for the return type :
QName qn = new QName("urn:my.package.FirstClass","InnerBean");
call.registerTypeMapping(my.package.FirstClass.InnerBean.class,qn,
new BeanSerializerFactory(my.package.FirstClass.InnerBean.class,qn),
new BeanDeserializerFactory(my.package.FirstClass.InnerBean.class,qn));
call.setReturnType(qn);
FirstClass.InnerBean beanReturned=(FirstClass.InnerBean)call.invoke(objectArray);
The problem is that there are no problems server-side, I can watch the SOAP message that return what i want.
Client-side, I get an exception :
org.xml.sax.SAXException: Unable to create JavaBean of type my.package.FirstClass$InnerBean. Missing default constructor? Error was: java.lang.InstantiationException: my.package.FirstClass$InnerBean.
(and of course, both classes FirstClass and InnerBean have a default constructor).
I don't know where is the problem, in the wsdd, on the client, on the server?
