title: How do you generate REST service template with wadl2java where POST/PUT methods have parameters?
body: <p>I’ve read that the wadl2java code generator and cxf-wadl2java-plugin Maven plugin “can be used to generate server and client JAX-RS code…” However, for anything besides GET requests, the generated code seems useless.</p>
  
  <p>For example, if I use the following WADL file:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;application
    xmlns="http://wadl.dev.java.net/2009/02"
    xmlns:ns="http://superbooks"&gt;
    &lt;grammars&gt;
      &lt;include
        href="book.xsd"/&gt;
    &lt;/grammars&gt;
    &lt;resources
      base="http://localhost:8080/"&gt;
      &lt;resource
        path="/bookstore/put"
        id="poster"&gt;
        &lt;method
          name="POST"
          id="postBook"&gt;
          &lt;request&gt;
            &lt;representation
              mediaType="application/xml"
              element="ns:Book"/&gt;
          &lt;/request&gt;
          &lt;response&gt;
            &lt;representation
              mediaType="*/*"/&gt;
          &lt;/response&gt;
        &lt;/method&gt;
      &lt;/resource&gt;
    &lt;/resources&gt;
  &lt;/application&gt;
  </code></pre>
  
  <p>And this as a schema:</p>
  
  <pre><code>&lt;?xml version="1.0"?&gt;
  &lt;xs:schema
    id="bookschema"
    targetNamespace="bookschema"
    elementFormDefault="qualified"
    xmlns:xs="http://www.w3.org/2001/XMLSchema"
    xmlns:ns="bookschema"
    &gt;
  
    &lt;xs:complexType name="Book"&gt;
      &lt;xs:sequence&gt;
        &lt;xs:element name="id" type="xs:integer"/&gt;
        &lt;xs:element name="name" type="xs:string"/&gt;
      &lt;/xs:sequence&gt;
    &lt;/xs:complexType&gt;
    &lt;xs:element name="Book" type="ns:Book"/&gt;
  &lt;/xs:schema&gt;
  </code></pre>
  
  <p>The code that is generated looks like this:</p>
  
  <pre><code>/**
   * Created by Apache CXF WadlToJava code generator
  **/
  package com.cxf.test;
  
  import javax.ws.rs.Consumes;
  import javax.ws.rs.POST;
  import javax.ws.rs.Path;
  import javax.ws.rs.Produces;
  import javax.ws.rs.core.Response;
  
  @Path("/bookstore/put")
  public interface Poster {
  
      @POST
      @Consumes("application/xml")
      @Produces("*/*")
      Response postBook();
  
  }
  </code></pre>
  
  <p>I would have expected the method to look more like this:</p>
  
  <pre><code>    @POST
      @Consumes("application/xml")
      @Produces("*/*")
      Response postBook(Book book);
  </code></pre>
  
  <p>How is it useful to have a POST method that takes no parameters?</p>
  
  <p>Ultimately, I want to receive JSON instead of XML, but I thought first I should get XML, which is the normal use-case for CXF, working.</p>
  
  <p>I suspect this has something to do with a binding file, but I can’t find anything concrete about how.</p>