This week's book giveaway is in the OCPJP forum.
We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line!
See this thread for details.
The moose likes Web Services and the fly likes JAXB bindings Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Java » Web Services
Bookmark "JAXB bindings" Watch "JAXB bindings" New topic
Author

JAXB bindings

Philip Grove
Ranch Hand

Joined: Aug 18, 2009
Posts: 68

I am trying to use a web service where I have no control of the WSDL. Unfortunately the WSDL defines the result elements like this:


I have an external XSD that defines the element in greater detail, and a JAXB binding file that should bind the element from the WSDL to the class generated by compiling the XSD. The binding file looks like this:


The schema defines a different targetNamespace than the WSDL so elements with the same name should be legal.

The JAXB bindings are ignored so there is a probably an error somewhere but I have been unable to find out where. I am hoping that people here can help as the sequence of <any> in the WSDL is beginning to cause problems.
Philip Grove
Ranch Hand

Joined: Aug 18, 2009
Posts: 68

To make information a little more complete here are the complete WSDL:



And the complete XSD:



Any other solutions that will make the elements from the XSD used are completely acceptable as well. I am looking at JAXWS bindings of the wsdl:portType but the documentation, or lack thereof, is just as confusing as it is for JAXB bindings.
Ivan Krizsan
Ranch Hand

Joined: Oct 04, 2006
Posts: 2198
    
    1
Hi!
Since nothing was said, I assume you want to generate artifacts for a client that is to access the webservice using wsimport.
Have you used the -b flag? The -b flag, after which a JAXB binding file is specified, is available both in wsimport and xjc (the JAXB binding compiler).
Example:
wsimport -b MyJAXBBindingFile.xml MyWSDL.wsdl ...
xjc -b MyJAXBBindingFile.xml MyXMLSchema.xsd

References:
http://java.sun.com/webservices/docs/1.5/tutorial/doc/JAXBUsing4.html
http://linux.die.net/man/1/wsimport-java-1.6.0-openjdk
Best wishes!
 
Don't get me started about those stupid light bulbs.
 
subject: JAXB bindings