users@jersey.java.net

Re: [Jersey] [WADL] How to make local schema navigated in WADL grammars

From: Martin Grotzke <martin.grotzke_at_freiheit.com>
Date: Thu, 05 Feb 2009 13:49:07 +0100

Hi,

On Thu, 2009-02-05 at 11:48 +0800, wei zhou wrote:
> Hi all, I am a newer to Jersey.
welcome :)

>
> Jersery is able to add customerized documententation & grammars to its
> WADL.
>
> For adding grammars to the WADL, the wadl generator reads schema info
> from file "application-grammars.xml", where I want to add local XSD
> files.
Exactly. The WadlGeneratorGrammarsSupport reads some xml file and adds
the grammars element to the application.wadl.

>
> The "application-grammars.xml" is like this:
>
> <grammars xmlns="http://research.sun.com/wadl/2006/10"
> xmlns:xsd="http://www.w3.org/2001/XMLSchema"
> xmlns:xi="http://www.w3.org/1999/XML/xinclude">
> <xsd:include schemaLocation="ABC.xsd" />
> <!-- include href="ABC.xsd" -->
> </grammars>
You should use the
  <include href="ABC.xsd" />

(I'm just comparing with the application-grammars.xml of the
generate-wadl/extended-wadl-webapp sample... :)

And perhaps you can put some
  <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
at the top? But I don't think that this produces issues if missing (but
not sure).

>
> In the case, "ABC.xsd" is a local schema in my project that it does
> not have a final static url. After the project is deployed to web
> server, this "ABC.xsd" is not navigated in its WADL file.
Hmm, what do you mean with "navigated"? The first thing to check is if
the application.wadl contains the content of your
application-grammars.xml. If so, the job of the
WadlGeneratorGrammarsSupport is done.

The ABC.xsd should live besides the generated application.wadl then. If
you use static generation of the wadl (at build time, as shown by the
generate-wadl sample), this is the same directory. If the
application.wadl is generated at runtime and you access it at e.g.
http://localhost:8080/yourapp/application.wadl, the ABC.xsd should be
available at http://localhost:8080/yourapp/ABC.xsd I'd say.

I hope this helps,
cheers,
Martin


> For example, my project is deployed in the JBOSS where "ABC.xsd" is
> located in "myApp.war/web-inf/wsdl/ABC.xsd".
>
> How to make "ABC.xsd" navigated in the WADL file?