title: JAX-WS: Place a wrapper around an ArrayList being returned
body: <p>I have the following endpoint interface:</p>
  
  <pre><code>@WebService
  public interface SEIWebService {
  
      @WebMethod
      @WebResult(name="CreateWorkOrderItemResponse")
      CreateWorkOrderItemResponse createWorkItem(@WebParam(name = "CreateWorkOrderItemRequest")CreateWorkOrderItemRequest request);
  }
  </code></pre>
  
  <p>The implementation:</p>
  
  <pre><code>@WebService(endpointInterface = "com.someCompany.SEIWebService", portName = "SEIWebServices")
  public class SEIWebServiceImpl implements SEIWebService{
  
      @Override
      public CreateWorkOrderItemResponse createWorkItem(CreateWorkOrderItemRequest request) {
          CreateWorkOrderItemResponse response = new CreateWorkOrderItemResponse();
          response.setResponseCode("Testing Create 2222");
          response.addError("Error 1");
          response.addError("Error 2");
  
          return response;
      }
  </code></pre>
  
  <p>And lastly, the code for the response object</p>
  
  <pre><code>public class CreateWorkOrderItemResponse {
      private String responseCode = null;
      private ArrayList&lt;String&gt; errorList = new ArrayList&lt;String&gt;();
  
      public void setResponseCode(String responseCode) {
          this.responseCode = responseCode;
      }
  
      public String getResponseCode() {
          return responseCode;
      }
  
      public void addError(String error) {
          errorList.add(error);
      }
  
      public void setErrorList(ArrayList&lt;String&gt; errorList) {
          this.errorList = errorList;
      }
  
      public ArrayList&lt;String&gt; getErrorList() {
          return errorList;
      }
  }
  </code></pre>
  
  <p>When I run this code, the response back in SoapUI comes out like this:</p>
  
  <pre><code>&lt;S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/"&gt;
     &lt;S:Body&gt;
        &lt;ns2:createWorkItemResponse xmlns:ns2="http://someCompany.com/"&gt;
           &lt;CreateWorkOrderItemResponse&gt;
              &lt;errorList&gt;Error 1&lt;/errorList&gt;
              &lt;errorList&gt;Error 2&lt;/errorList&gt;
              &lt;responseCode&gt;Testing Create 2222&lt;/responseCode&gt;
              &lt;testList/&gt;
           &lt;/CreateWorkOrderItemResponse&gt;
        &lt;/ns2:createWorkItemResponse&gt;
     &lt;/S:Body&gt;
  &lt;/S:Envelope&gt;
  </code></pre>
  
  <p>Finally, <strong>the question</strong>... With the code above, is there a way to change it so I can add a "wrapper" around the errorList responses? I am looking to have the SOAP message response look like this:</p>
  
  <pre><code>&lt;S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/"&gt;
     &lt;S:Body&gt;
        &lt;ns2:createWorkItemResponse xmlns:ns2="http://someCompany.com/"&gt;
           &lt;CreateWorkOrderItemResponse&gt;
              &lt;Errors&gt;
                  &lt;errorList&gt;Error 1&lt;/errorList&gt;
                  &lt;errorList&gt;Error 2&lt;/errorList&gt;
              &lt;/Errors&gt;
              &lt;responseCode&gt;Testing Create 2222&lt;/responseCode&gt;
              &lt;testList/&gt;
           &lt;/CreateWorkOrderItemResponse&gt;
        &lt;/ns2:createWorkItemResponse&gt;
     &lt;/S:Body&gt;
  &lt;/S:Envelope&gt;
  </code></pre>
  
  <p>Thank you all for the help!</p>