title: Java - How to get rid of namespaces within Soap Requests (ns2)
body: <p>I am using JAXB to print out the XML string that corresponds to the Soap UI request that my code is generating. For whatever reason, JAXB is automatically placing &quot;ns2&quot; namespaces in the opening and closing tags of my generated request, which consequently leads to a SoapFault error.</p>
  <p>For context this is how my generated request looks like:</p>
  <pre><code>&lt;soapenv:Envelope xmlns:soapenv=&quot;http://schemas.xmlsoap.org/soap/envelope/&quot; xmlns:urn=&quot;urn:com.unsolicited.notifications&quot;&gt;
     &lt;soapenv:Header/&gt;
     &lt;soapenv:Body&gt;
        &lt;urn:sendUnsolicitedNotification&gt;
           &lt;ns2:UnsolicitedNotificationRequest xmlns:ns2=&quot;urn:com.unsolicited.notifications.bo&quot;&gt;
              &lt;otherInfo&gt;
                 &lt;key&gt;clientEmail&lt;/key&gt;
                 &lt;value&gt;xx@gmail.com&lt;/value&gt;
              &lt;/otherInfo&gt;
              &lt;otherInfo&gt;
                 &lt;key&gt;emailBody&lt;/key&gt;
                 &lt;value&gt;This is my email body&lt;/value&gt;
              &lt;/otherInfo&gt;
           &lt;/ns2:UnsolicitedNotificationRequest xmlns:ns2=&quot;urn:com.unsolicited.notifications.bo&quot;&gt;
        &lt;/urn:sendUnsolicitedNotification&gt;
     &lt;/soapenv:Body&gt;
  &lt;/soapenv:Envelope&gt;
  </code></pre>
  <p>As you can see the opening and closing tags for UnsolicitedNotificationRequest has ns2 namespaces which I would like to get rid of.</p>