title: JAX-WS: why nested elements are in "" namespace?
body: <p>Having a toy service as below</p>
  
  <pre><code>@WebService(targetNamespace="http://www.example.org/stock")
  @SOAPBinding(style=Style.RPC,parameterStyle=ParameterStyle.WRAPPED)
  public class GetStockPrice {
      @WebMethod(operationName="GetStockPrice",action="urn:GetStockPrice")
      @WebResult(partName="Price")
      public Double getPrice(
              @WebParam(name="StockName")
              String stock
          ) {
          return null;
      }
  }
  </code></pre>
  
  <p>JAX-WS-generated client creates a SOAP message where StockName parameter has no namespace:</p>
  
  <pre><code>&lt;?xml version='1.0' encoding='UTF-8'?&gt;
  &lt;S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/"&gt;
    &lt;S:Body&gt;
      &lt;ns2:GetStockPrice xmlns:ns2="http://www.example.org/stock"&gt;
        &lt;StockName&gt;IBM&lt;/StockName&gt;
      &lt;/ns2:GetStockPrice&gt;
    &lt;/S:Body&gt;
  &lt;/S:Envelope&gt;
  </code></pre>
  
  <p>I would expect and wish StockName to be generated as </p>
  
  <pre><code>  &lt;ns2:StockName&gt;IBM&lt;/ns2:StockName&gt;
  </code></pre>
  
  <p>i.e. in the target namespace, not in the anonymous one (ns2 is not default, as far as I can see from the message).</p>
  
  <p>I wonder how to make JAX-WS to add the target namespace to the nested elements of the message?</p>
  
  <p>An attempt to specify the namespace to WebParam annotation changed nothing as this param is ignored when RPC is used. </p>
  
  <p>Or... Does it mean that parameters in RPC-style are always anonymous?</p>
  
  <p><strong>UPDATE</strong></p>
  
  <p>Silly me. Partially solved. What I had to do is </p>
  
  <ul>
  <li>style=Document, to enable target namespaces for elements</li>
  <li>param style=Wrapped, to enable top level element</li>
  <li>specify target namespace for WebParam (why service one is not used? documentation says service namespace should be used)</li>
  </ul>
  
  <p>That is:</p>
  
  <pre><code>@WebService(targetNamespace="http://www.example.org/stock")
  @SOAPBinding(style=Style.DOCUMENT,parameterStyle=ParameterStyle.WRAPPED)
  public class GetStockPrice {
      @WebMethod(operationName="GetStockPrice",action="urn:GetStockPrice")
      @WebResult(partName="Price")
      public Double getPrice(
              @WebParam(name="StockName",targetNamespace="http://www.example.org/stock")
              String stock
          ) {
          return null;
      }
  }
  </code></pre>
  
  <p>Still, client still expects return value without any namespace, even if I try to declare provide one. This is confusing.</p>