• Post Reply Bookmark Topic Watch Topic
  • New Topic

Building Restful Service Client - Issues in generating java binding calsses for XML  RSS feed

 
Aravind Konda
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Freinds,
I am building restful service client. I got the schema (XSD) for response . I am trying to generate java XML binding classes using JAXB xjc tool. My schema has one line similar to below.

<xs:import namespace="http://somehost.com/ddd/aa/xyz" schemaLocation="../../xyz.xsd" />

While running xjc tool against schema it is failing with file not found for "xyz.xsd" , is tool checking for xyz.xsd at server side (mentioned in namepace attribute) "somehost.com" or do I need to have xyz.xsd at the location ../../xyz.xsd with respect directory where xjc.bat tool is located.
 
g tsuji
Ranch Hand
Posts: 697
3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
While running xjc tool against schema it is failing with file not found for "xyz.xsd" , is tool checking for xyz.xsd at server side (mentioned in namepace attribute) "somehost.com" or do I need to have xyz.xsd at the location ../../xyz.xsd with respect directory where xjc.bat tool is located.

There are certainly quite a number of doubtful conceptions in this query.

If we focus on the xs:import line only, whenever the relative path is used for the imported xsd (here xyz.xsd), the context is referred to the location of the importing xsd (here the xsd file where xs:import line appears). If the importing xsd is remote, the remote location is looking for the imported xsd, similarly, if local, local.

Then comes the nature of the schemaLocation itself in the xs:import, it is only taken as a "hint" (so to speak). If the application decides to override it, it can be and should be allowed to be done. To simplify the thing at this stage, you have that "hint" taken to be the only piste to follow and that's fine.

Then comes another doubtful way of thinking reflected in, quote, is tool checking for xyz.xsd at server side (mentioned in namepace attribute) "somehost.com", unquote. The uri of the namespace attribute provides no information what so ever where to look for the file in the schemaLocation. If there is some correlation, it is only by coincidence, and a priori, there is no relation to "somehost.com" there.

Do you need to have xyz.xsd at the local? It is yes or no. If the importing xsd file is in a local file system, then absolutely xyz.xsd should (modulo again the freedom which is always there namely the application can be instructed to go anywhere - as it is always a "hint" only). If the importing xsd is in a remote repository, so should xyz.xsd be.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!