I have an instance of a derived class (called Child
) that I would like to send between the client and server of my web service. However, the method that might be returning this instance, is marked as returning an instance of the parent class (called Parent
).
For example:
public class Service{public Parent createInstanceOfParentOrChildObject();}
While Child
is not a parameter anywhere in the service nor is it ever specifically named as a return type (only Parent
is ever named), it is nonetheless generated and returned inside certain methods (and then cast to Parent
).
I generated the wsdl file using Axis2 1.4.1 java2wsdl
and specifying that it include this class (using the -xc parameter). I did not use Axis2 1.5.1 because it was not honoring the -xc parameter though it looks like that bug is supposedly fixed in Axis2 1.6. I even did a quick check of the generated .wsdl file to ensure that it did indeed include a definition for Child
(and, of course, Parent
).
However, when I used wsdl2java
to generate the server-side (and client-side) code, Child
was not generated.
How can I get wsdl2java
to generate Child
?