title: Does JAXWS client make difference between an empty collection and a null collection value as returned value?
body: <p>Since JAX-WS rely on JAXB, and since I observed the code that unpack the XML bean in JAX-B Reference Implementation, I guess the difference is not made and that a JAXWS client always return an empty collection, even the webservice result was a null element:</p>
  
  <pre><code>public T startPacking(BeanT bean, Accessor&lt;BeanT, T&gt; acc) throws AccessorException {
          T collection = acc.get(bean);
          if(collection==null) {
              collection = ClassFactory.create(implClass);
              if(!acc.isAdapted())
                  acc.set(bean,collection);
          }
          collection.clear();
          return collection;
      }
  </code></pre>
  
  <p>I agree that for best interoperability service contracts should be non ambiguous and avoid such differences, but it seems that the JAX-WS service I'm invoking (hosted on a Jboss server with Jbossws implementation) is always returning as expected a null empty collection (tested with SoapUI).</p>
  
  <p>I used for my test code generated by wsimport.
  Return element is defined as:</p>
  
  <pre><code>@XmlElement(name = "return", nillable = true)
  protected List&lt;String&gt; _return;
  </code></pre>
  
  <p>I even tested to change the Response class getReturn method from :</p>
  
  <pre><code>public List&lt;String&gt; getReturn() {
      if (_return == null) {
          _return = new ArrayList&lt;String&gt;();
      }
      return this._return;
  }
  </code></pre>
  
  <p>to </p>
  
  <pre><code>public List&lt;String&gt; getReturn() {
      return this._return;
  }
  </code></pre>
  
  <p>but without success.</p>
  
  <p>Any helpful information/comment regarding this problem is welcome !</p>