title: JAX-WS Client won't accept blank namespace in SOAP Response
body: <p>I'm trying to pull data from a webservice using JAX-WS and code generated by <code>wsimport</code>. I'm able to send the request and get a response from the server, but JAX-WS is throwing an exception when it tries to read the response because no elements in the response body have a declared namespace.</p>
  
  <pre><code>Exception in thread "main" com.sun.xml.internal.ws.streaming.XMLStreamReaderException: unexpected XML tag. expected: {http://www.theserver.com/cmdb_rel_ci}getRecordsResponse but found: {null}getRecordsResponse
  </code></pre>
  
  <p><strong>WSDL Excerpt:</strong></p>
  
  <pre><code>&lt;wsdl:definitions xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:tns="http://www.theserver.com/cmdb_rel_ci" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:sncns="http://www.theserver.com" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" targetNamespace="http://www.theserver.com"&gt;
    &lt;wsdl:types&gt;
      &lt;xsd:schema elementFormDefault="unqualified" targetNamespace="http://www.theserver.com/cmdb_rel_ci"&gt;
        &lt;xsd:element name="getRecords"&gt;
          &lt;xsd:complexType&gt;
            &lt;xsd:sequence&gt;
              &lt;!-- Request arguments --&gt;
            &lt;/xsd:sequence&gt;
          &lt;/xsd:complexType&gt;
        &lt;/xsd:element&gt;
        &lt;xsd:element name="getRecordsResponse"&gt;
          &lt;xsd:complexType&gt;
            &lt;xsd:sequence&gt;
              &lt;xsd:element maxOccurs="unbounded" minOccurs="0" name="getRecordsResult"&gt;
                &lt;xsd:complexType&gt;
                  &lt;xsd:sequence&gt;
                    &lt;!-- Response Fields --&gt;
                  &lt;/xsd:sequence&gt;
                &lt;/xsd:complexType&gt;
              &lt;/xsd:element&gt;
            &lt;/xsd:sequence&gt;
          &lt;/xsd:complexType&gt;
        &lt;/xsd:element&gt;
      &lt;/xsd:schema&gt;
    &lt;/wsdl:types&gt;
    &lt;wsdl:message name="getRecordsSoapIn"&gt;
      &lt;wsdl:part name="cmdb_rel_ci" element="tns:getRecords"&gt;&lt;/wsdl:part&gt;
    &lt;/wsdl:message&gt;
    &lt;wsdl:message name="getRecordsSoapOut"&gt;
      &lt;wsdl:part name="cmdb_rel_ci" element="tns:getRecordsResponse"&gt;&lt;/wsdl:part&gt;
    &lt;/wsdl:message&gt;
  &lt;/wsdl:definitions&gt;
  </code></pre>
  
  <p><strong>Successful Request and Response in SoapUI:</strong></p>
  
  <pre><code>&lt;soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns2="http://www.theserver.com/cmdb_rel_ci"&gt;
    &lt;soapenv:Header/&gt;
    &lt;soapenv:Body&gt;
      &lt;ns2:getRecords&gt;
        &lt;arg1&gt;value&lt;/arg1&gt;
        &lt;!-- Remaining Arguments --&gt;
      &lt;/ns2:getRecords&gt;
    &lt;/soapenv:Body&gt;
  &lt;/soapenv:Envelope&gt;
  
  
  &lt;SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"&gt;
    &lt;SOAP-ENV:Body&gt;
      &lt;getRecordsResponse&gt;
        &lt;getRecordsResult&gt;
          &lt;resultField1&gt;value&lt;/resultField1&gt;
          &lt;resultField2&gt;value2&lt;/resultField2&gt;
          &lt;!-- etc. --&gt;
        &lt;/getRecordsResult&gt;
        &lt;!-- Other getRecordsResult elements --&gt;
      &lt;/getRecordsResponse&gt;
    &lt;/SOAP-ENV:Body&gt;
  &lt;/SOAP-ENV:Envelope&gt;
  </code></pre>
  
  <p>How do I tell JAX-WS that the <code>&lt;getRecordsResponse&gt;</code> element won't have a namespace? I've tried setting <code>targetNamespace = ""</code> in the <code>@ResponseWrapper</code> annotation for <code>getRecords()</code>, but that just makes it expect the targetNamespace parameter from <code>@WebService</code> instead. And when I tried as a last-ditch effort to set the WebService's target namespace blank, it tried to infer a namespace from the Java package name (e.g. "<a href="http://my_package.com" rel="nofollow">http://my_package.com</a>"). </p>