File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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
JavaRanch » Java Forums » Java » Web Services
Bookmark "JAXB bindings" Watch "JAXB bindings" New topic

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
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).
wsimport -b MyJAXBBindingFile.xml MyWSDL.wsdl ...
xjc -b MyJAXBBindingFile.xml MyXMLSchema.xsd

Best wishes!
It is sorta covered in the JavaRanch Style Guide.
subject: JAXB bindings
It's not a secret anymore!