title: RESTful Webservice - How to provide custom Classes' .xsd in xml output
body: <p>I've been searching like one and a half days but I can't find any useful answer...
  (anyway, know I definetly know how to write webservices :D)</p>
  
  <p>Here's my situation:
  I am triying to setup a RESTful Webservices environment that provides returns an object names Greeting:</p>
  
  <p><strong>Greeting.class</strong></p>
  
  <pre><code>@XmlRootElement(name = "greeting")
  public class Greeting {
  
      private String message;
      private String name;
  
      public Greeting() {
      }
  
      public Greeting(String message, String name) {
          this.message = message;
          this.name = name;
      }
  
      @XmlElement
      public String getMessage() {
          return message;
      }
  
      public void setMessage(String message) {
          this.message = message;
      }
  
      @XmlElement
      public String getName() {
          return name;
      }
  
      public void setName(String name) {
          this.name = name;
      }
  }
  </code></pre>
  
  <p>The Webservice just returns an instance of Greeting... thats all! </p>
  
  <p><strong>GreetingService.class</strong></p>
  
  <pre><code>@Path("sayHello")  
  public class GreetingService {
        @Context
        private UriInfo context;
        public GreetingService() {
        }
  
        @GET
        @Produces("application/xml")
        public Greeting getJson(@QueryParam("name") String name) {
            return new Greeting(getGreeting(), name);
        }
  
        private String getGreeting() {
            return "Good " + (Calendar.getInstance().get(Calendar.AM_PM) == Calendar.AM ? "Morning" : "Afternoon");
        }
  } 
  </code></pre>
  
  <p>And the result in the browser is this
  <strong>Browser</strong></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8" standalone="yes"?&gt;
  &lt;greeting&gt;
      &lt;message&gt;Good Afternoon&lt;/message&gt;
  &lt;/greeting&gt;
  </code></pre>
  
  <p>There is no information given about the detailed structure of Greeting.class :(
  But other clients, who talk to the webservice might need it (yeah it's simple - BUT it's just an example!)</p>
  
  <p>Do I have to configure anything? Maybe the application.wadl? I've no idea - was googling like I said - nearly two days :(
  Please help me! 
  BTW - I am using Netbeans, Java 7, JEE6 and Jersey</p>
  
  <hr>
  
  <p>EDIT</p>
  
  <p>Maybe I didn't ask correctly...
  How can i automaticly provide the needed .xsd schema for Greeting?</p>
  
  <p>Here's the application.wadl, which is provides at the moment...</p>
  
  <pre><code>&lt;application xmlns="http://research.sun.com/wadl/2006/10"&gt;
  &lt;doc xmlns:jersey="http://jersey.java.net/" jersey:generatedBy="Jersey: 1.8 06/24/2011 12:17 PM"/&gt;
      &lt;resources base="http://localhost/iOSWebServices/resources/"&gt;
          &lt;resource path="greeting"&gt;
              &lt;method id="greet" name="GET"&gt;
                  &lt;response&gt;
                      &lt;representation mediaType="application/xml"/&gt;
                  &lt;/response&gt;
              &lt;/method&gt;
              &lt;method id="putXml" name="PUT"&gt;
                  &lt;request&gt;
                      &lt;representation mediaType="application/xml"/&gt;
                  &lt;/request&gt;
              &lt;/method&gt;
          &lt;/resource&gt;
      &lt;/resources&gt;
  &lt;/application&gt;
  </code></pre>
  
  <p>I found out, that there has to be a param "element" in the response representation - HOW can I set it there? Yeah I could use the WADL Plugin for Netbeans and type it in manually - but I have to add a schema reference for the element - in this case "Greeting" - and I still don't know how to set the namespace for the Greeting.class correctly :(</p>
  
  <hr>
  
  <p>EDIT</p>
  
  <p>I might have found what I was looking for..
  <a href="http://www.verborgh.be/articles/2009/11/21/easy-restfull-jax-rs-webservices-and-extended-wadl-on-glassfish-v3-using-ant-/" rel="nofollow">http://www.verborgh.be/articles/2009/11/21/easy-restfull-jax-rs-webservices-and-extended-wadl-on-glassfish-v3-using-ant-/</a>
  This article explains what I wanted to know :)
  Still have one exception in the last step when overriding  the WADL generation but I think, this is a version bug - gonna try to update jersey or to find a workaround!</p>