my dog learned polymorphism*
The moose likes XML and Related Technologies and the fly likes How to generate JAXB Bindings for the xml element definition which is extending from other xml Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "How to generate JAXB Bindings for the xml element definition which is extending from other xml" Watch "How to generate JAXB Bindings for the xml element definition which is extending from other xml" New topic
Author

How to generate JAXB Bindings for the xml element definition which is extending from other xml

Kumar Raja
Ranch Hand

Joined: Mar 18, 2010
Posts: 518
    
    2

Hi All,

I have following xsd, from which I'm trying to generate JAXB bindings using maven plugin.



As you see above I have the above schema defined, such thta request type is completely defined in the above schema, but response is referred to a type defined in another schema.

Now, when I ran the JAXB, I see MainRequest.java something like below




but I do not see any response object as below




but instead see below class being generated as expected under shared/simpleInfo


Is there any way, like customizing the binding, so that JAXB generates class what I want, as changing the xsd is out of scope for us. Please advice.

The very reason I'm expecting to see an class MainResponse.java instead of simpleResponseType.java, is during the unmarshalling of the webservice response, we receive and the root element of the response would be <MainResponse> but not <SimpleResponseType>.

Any help here.


Regards
KumarRaja

Kumar Raja
Ranch Hand

Joined: Mar 18, 2010
Posts: 518
    
    2

If this question is not posted in the appropriate category, could some one move this to the right group, so that it gets the visibility it needed.
g tsuji
Ranch Hand

Joined: Jan 18, 2011
Posts: 499
    
    3
Before one can jump to any conclusion, I think one has to make sure the schema is properly constructed to define the vocabulary one is intended to define.

As far as I can see, you missed out the targetNamespace and that is critical. I wold say add that attribute and make sure you mean to have MainRequest and MainResponse defined in that namespace or which one in which namespace (the target namespace or the imported namespace).
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to generate JAXB Bindings for the xml element definition which is extending from other xml
 
Similar Threads
How to: representing a list of objects in XSD??
jaxws and polymorfism
JAXB does not generate @XmlRootElement
Generating less JAXB classes
@WebService method returning a custom class containing a HashMap / JAX-WS