wood burning stoves 2.0*
The moose likes Web Services and the fly likes jaxws and polymorfism Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Web Services
Bookmark "jaxws and polymorfism" Watch "jaxws and polymorfism" New topic
Author

jaxws and polymorfism

avihai marchiano
Ranch Hand

Joined: Jan 10, 2007
Posts: 342
Hey,

how to represent method that types that inherit from base class?

Thank you
Ivan Krizsan
Ranch Hand

Joined: Oct 04, 2006
Posts: 2198
    
    1
Hi!
XML also supports inheritance, see this link: http://www.brics.dk/~amoeller/XML/schemas/xmlschema-inheritance.html
As far as overloaded method names are concerned, this is prohibited by the WS-I Basic Profile and must not be used.
Reference: http://www.ws-i.org/Profiles/BasicProfile-1.1.html#Distinctive_Operations
Best wishes!
avihai marchiano
Ranch Hand

Joined: Jan 10, 2007
Posts: 342
Yep, i know that xsd support inheritance.

I work with jax-ws and the wsdl is generated for my method.
So it generate only the base type in the wsdl and jaxb classes

my questions:
1. is there a way to tell him to generate also the inherited types?
2. does it work if i add the types manually to the wsdl?


Thank you
Ivan Krizsan
Ranch Hand

Joined: Oct 04, 2006
Posts: 2198
    
    1
Hi!
So I finally had a chance to check this by writing some code...
Here is what I did:
1. Created a base class for responses called ResponseBase.
2. Created a class for responses called ResponseOne that is a subclass of ResponseBase.
3. Created an endpoint implementation class with the following method:

4. Using the wsgen command in JDK 6, I generated additional artifacts.
This is a section of the generated XML schema describing the response types:

Note that the complex type responseOne is wrapped in the generated complex type findResponseOneResponse. This is because the SOAP binding parameter style is set to wrapped. If it were set to bare, then the findResponseOneResponse element would be declared like this:


The generated class FindResponseOneResponse looks like this:

Note that this class only contains one ResponseOne object.
Note that the ResponseOne class is the class I implemented myself and JAXB thus does not need to generate it.
Given the above, I do not quite see where your problem is. Perhaps our environment or tools are different in some way.

To answer your second question: Yes, after having generated a WSDL, you can manipulate it by hand and use it.
To preserve the hand-manipulated WSDL when deploying, you configure the @WebService annotation that annotates the endpoint implementation class in the following manner:

Best wishes!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: jaxws and polymorfism