File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Web Services and the fly likes schemaLocation ignored when marshalling JAXB Classes using Metro Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Web Services
Bookmark "schemaLocation ignored when marshalling JAXB Classes using Metro" Watch "schemaLocation ignored when marshalling JAXB Classes using Metro" New topic
Author

schemaLocation ignored when marshalling JAXB Classes using Metro

Joe carco
Ranch Hand

Joined: Apr 14, 2009
Posts: 82
This is a question that was posted on StackOverflow, that nobody has answered yet.
I hope nobody minds me repeating the question here at the saloon:

I'm using the Metro stack bundled with Java 6 SE to call a web service. The web service expects XML as a parameter. I use JAXB classes to create content and pass my JAXB root element to the web service endpoint.

Now to my Problem: I can't find any way to make the marshaller include the schemaLocation of the XSD file since I can't directly access the marshaller. (If you have direct access to the marshaller it is possible do set the schemalocation as a property, but when using metro, all the marshalling seems to be happening internally.)

I've tried setting the xsi:schemaLocation in the XmlSchema annotation in the generated package-info.java class, but this had no effect on the xml generated.


Does anyone have any ideas how to solve this problem?
Rizwan Patel
Ranch Hand

Joined: Jan 03, 2008
Posts: 59
You can set this property on the Marshaller for including the namespace in generated XML.


scjp 1.5, OCPJWSD 5
Joe carco
Ranch Hand

Joined: Apr 14, 2009
Posts: 82
Thank you for your reply, but I already know hat. If you read my posting carefully, you will See hat your suggestion is not an option. I dont have access to the marshaller as I am passing my jaxb object directly to the webservice end point. My Guess is that Metro uses the marshaller internally.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: schemaLocation ignored when marshalling JAXB Classes using Metro
 
Similar Threads
Help: Creating web service proxy using JAXB generated domains
Facade design pattern in web services
Java objects to XML, possibly using JAXB
Unable to locate jaxb.properties
.NET WSDL client generation