title: Java Web Service - List vs Array
body: <p>I'm new to web service. I'm writing some simple web services for testing and I have the following questions.</p>
  
  <p>The website <a href="http://docs.oracle.com/javaee/1.4/tutorial/doc/JAXRPC4.html" rel="nofollow">here</a> says that JAX-RPC supports array of primitive types. But when I write a simple web service </p>
  
  <pre><code>@WebService
  @SOAPBinding(style=Style.RPC)
  public interface AddNums {
      @WebMethod
      public int addNumbers(int[] nums);
  
  }
  </code></pre>
  
  <p>and generate the client code from wsdl i get the following WS client interface.</p>
  
  <pre><code>@WebMethod
  @WebResult(partName = "return")
  public int addNumbers(
      @WebParam(name = "arg0", partName = "arg0")
      IntArray arg0); 
  </code></pre>
  
  <p>It generates IntArray class having the member protected List</p>
  
  <pre><code>public class IntArray {
  
      @XmlElement(nillable = true)
      protected List&lt;Integer&gt; item;
  </code></pre>
  
  <p>Is this how the arrays are supported? So, the only way to pass the array is to create an instance of <strong>IntArray</strong> and set <strong>List</strong> of <strong>Integers</strong> to it?</p>
  
  <p>Also when i make the webservice to <strong>Document</strong> style</p>
  
  <p>The WS client interface from WSDL has the following method:</p>
  
  <pre><code>public int addNumbers(
      @WebParam(name = "arg0", targetNamespace = "")
      List&lt;Integer&gt; arg0);
  </code></pre>
  
  <p>The <strong>int[ ]</strong> array in the original service, became <strong>List&lt; Integer></strong></p>
  
  <p>Does this mean that Array type in the web service is always converted to List in the client code generated from wsdl?</p>