title: Why does JAX-WS need wrapper classes?
body: <p>I created a simple webservice, which implements an add operation, and created some client files with wsimport. Now I want to include as less as possible wsdl specific artifacts. Here is an example of how the web service will be called:</p>
  
  <pre><code>String serviceNamespace = "http://jws.samples.geronimo.apache.org/";
  String serviceName = "CalculatorServiceService";
  QName serviceQN = new QName(serviceNamespace, serviceName);
  Service service = Service.create(new URL("http://localhost:8080/WebService/calculator?wsdl"), serviceQN);
  
  String portNamespace = "http://jws.samples.geronimo.apache.org/";
  String portName = "CalculatorServicePort";
  QName portQN = new QName(portNamespace, portName);
  Calculator myProxy = (Calculator) service.getPort(portQN, Calculator.class);
  </code></pre>
  
  <p>But it seems like I have to include wrapper classes for every message. For example the result message of the add operation:</p>
  
  <pre><code>@XmlAccessorType(XmlAccessType.FIELD)
  @XmlType(name = "addResponse", propOrder = { "_return" })
  public class AddResponse {
      @XmlElement(name = "return")
      protected int _return;
      public int getReturn() {
          return _return;
      }
      public void setReturn(int value) {
          this._return = value;
      }
  }
  </code></pre>
  
  <p>These wrappers are used within annotations in the service interface:</p>
  
  <pre><code>@WebService(name = "Calculator", targetNamespace = "http://jws.samples.geronimo.apache.org/")
  public interface Calculator {
      @WebMethod
      @RequestWrapper(className = "org.example.webservices.clients.dynamicproxy.Add")
      @ResponseWrapper(className = "org.example.webservices.clients.dynamicproxy.AddResponse")
      public int add(
          @WebParam(name = "value1", targetNamespace = "")
          int value1,
          @WebParam(name = "value2", targetNamespace = "")
          int value2);
  }
  </code></pre>
  
  <p>If the annotations are removed, the web service won't run. </p>
  
  <blockquote>
    <p>com.sun.xml.ws.model.RuntimeModelerException: runtime modeler error: Wrapper class org.example.webservices.clients.dynamicproxy.jaxws.Add is not found. Have you run APT to generate them?</p>
  </blockquote>
  
  <p>But why do I need those wrappers? Couldn't JAX-WS create those wrappers on-the-fly? Do you see any information, which couldn't be retrieved from the wsdl file?</p>