Axis2 Class Generation

Posted by Jack on Stack Overflow See other posts from Stack Overflow or by Jack
Published on 2010-06-12T19:05:36Z Indexed on 2010/06/12 19:12 UTC
Read the original article Hit count: 431

Filed under:
|
|
|

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? I realize that I could do this by hand but I don't want to have to do this for both the client and server. I was also hoping that I could make this as easy as possible for people to use my wsdl to generate their own clients.

© Stack Overflow or respective owner

Related posts about java

Related posts about wsdl