title: Cannot change soap URI in envelope using java SoapMessage
body: <p>I'm trying to create a simple SOAP message to send from a client, but I am (seemingly) unable to change the URI of the "soap" namespace in the envelope.</p>
  
  <p>This is what the soap header SHOULD look like:</p>
  
  <pre><code>&lt;soap:Envelope xmlns:soap="http://www.w3.org/2001/12/soap-envelope/"  soap:encodingStyle="http://www.w3.org/2001/12/soap-encoding/"&gt; ... &lt;/soap:Envelope&gt;
  </code></pre>
  
  <p>So I have the following code:</p>
  
  <pre><code>    final SOAPMessage sm = MessageFactory.newInstance().createMessage();
  
      final SOAPPart sp = sm.getSOAPPart();
      final SOAPEnvelope se = sp.getEnvelope();
      final SOAPHeader sh = se.getHeader();
      final SOAPBody sb = se.getBody();
  
      se.removeNamespaceDeclaration(se.getPrefix());
      se.addNamespaceDeclaration("soap", "http://www.w3.org/2001/12/soap-envelope");
      se.setPrefix("soap");
      sb.setPrefix("soap");
      sh.setPrefix("soap");
      se.setEncodingStyle("http://www.w3.org/2001/12/soap-encoding/");
  </code></pre>
  
  <p>However, when I print the message before sending, the following is my envelope:</p>
  
  <pre><code>&lt;soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" soap:encodingStyle="http://www.w3.org/2001/12/soap-encoding/"&gt;
  </code></pre>
  
  <p>Notice the differences in the URIs of xmlns:soap in the "should-be" section and the actual.</p>
  
  <p>If I change the first argument of the <code>addNamespaceDeclaration</code> call to "soapy" instead of "soap", this is the following envelope I get:</p>
  
  <pre><code>&lt;soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soapy="http://www.w3.org/2001/12/soap-envelope" soap:encodingStyle="http://www.w3.org/2001/12/soap-encoding/"&gt;
  </code></pre>
  
  <p>I'm guessing it may have something to do with the fact that the call is <code>addNamespaceDeclaration</code> rather than something like <code>changeNamespaceDeclaration</code>, and it is ignored considering the namespace is already present, but I cannot find something that works (I've already tried <code>setAttributeNS</code>).</p>
  
  <p>EDIT: I just realized that <code>setAttributeNS</code> is silly because that's changing the namespace, not the URI.
  EDIT AGAIN: I'm a little confused, as I continue to search I see sometimes that the naming goes <code>soap:"Namespace"</code>, so in that sense I do want to change the namespace... but I thought the namespace was the "soap" part. Any clarifications?</p>
  
  <p>This is my first post so I apologize if I'm asking something that has already been solved, but I've searched around and most of what I've found is related to changing the namespace (like from SOAP-ENV, which is the default namespace, to soap) rather than the URI itself. Thanks in advance.</p>
  
  <p>-M</p>