Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

schemaLocation ignored when marshalling JAXB Classes using Metro

 
Joe carco
Ranch Hand
Posts: 82
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 59
Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can set this property on the Marshaller for including the namespace in generated XML.
 
Joe carco
Ranch Hand
Posts: 82
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic