title: Adding the namespace for SOAP message body
body: <p>i want to add the name space for all the items in the SOAPbody, the configuration related to the XML manipulation is in below i added the name space for the header but it doesn't come to the SOAP-body</p>
  
  <pre><code>Boolean outboundProperty = (Boolean) smc.get(MessageContext.MESSAGE_OUTBOUND_PROPERTY);
  
          if (outboundProperty.booleanValue()) { 
              SOAPMessage message = smc.getMessage(); 
              try {
  
                  SOAPEnvelope envelope = smc.getMessage().getSOAPPart().getEnvelope();
                  System.out.println("Envelop : "+envelope);
  
                  envelope.addNamespaceDeclaration("sch", "http://api.jasperwireless.com/ws/schema");
  
                  SOAPHeader header = envelope.addHeader();
  
                  SOAPElement security =
                          header.addChildElement("Security", "wsse", "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd");
  
                  SOAPElement usernameToken =
                          security.addChildElement("UsernameToken", "wsse");
                  usernameToken.addAttribute(new QName("xmlns:wsu"), "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd");
  
                  SOAPElement username =
                          usernameToken.addChildElement("Username", "wsse");
                  username.addTextNode("XXXXXXXXX");
  
                  SOAPElement password =
                          usernameToken.addChildElement("Password", "wsse");
                  password.setAttribute("Type", "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText");
                  password.addTextNode("XXXXXXXXXXXXXX");
  
                  //Print out the outbound SOAP message to System.out
                  message.writeTo(System.out);
                  System.out.println("");
  
              } catch (Exception e) {
                  e.printStackTrace();
              }
  </code></pre>
  
  <p>and below is the XML that is created from the above code</p>
  
  <pre><code>&lt;S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/" xmlns:sch="http://api.jasperwireless.com/ws/schema"&gt;
          &lt;S:Header&gt;
              &lt;wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"&gt;
                  &lt;wsse:UsernameToken xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"&gt;
                      &lt;wsse:Username&gt;XXXXXX&lt;/wsse:Username&gt;
                      &lt;wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText"&gt;XXXXXXX&lt;/wsse:Password&gt;
                  &lt;/wsse:UsernameToken&gt;
              &lt;/wsse:Security&gt;
          &lt;/S:Header&gt;
          &lt;S:Body&gt;
              &lt;GetTerminalsByMsisdnRequest xmlns="http://api.jasperwireless.com/ws/schema"&gt;
                  &lt;messageId&gt;my message&lt;/messageId&gt;
                  &lt;version&gt;1.3&lt;/version&gt;
                  &lt;licenseKey&gt;537bba2a-9406-4703-a900-a8fee7a3f310&lt;/licenseKey&gt;
                  &lt;msisdns&gt;
                      &lt;msisdn&gt;65144099016324&lt;/msisdn&gt;
                  &lt;/msisdns&gt;
              &lt;/GetTerminalsByMsisdnRequest&gt;
          &lt;/S:Body&gt;
      &lt;/S:Envelope&gt; 
  </code></pre>
  
  <p>but i wanted to generate it like the below sample. im completely new to java and SOAP please help me</p>
  
  <pre><code>&lt;S:Body&gt;
              &lt;sch:GetTerminalsByMsisdnRequest xmlns="http://api.jasperwireless.com/ws/schema"&gt;
                  &lt;sch:messageId&gt;my message&lt;/messageId&gt;
                  &lt;sch:version&gt;1.3&lt;/version&gt;
                  &lt;sch:licenseKey&gt;537bba2a-9406-4703-a900-a8fee7a3f310&lt;/licenseKey&gt;
                  &lt;sch:msisdns&gt;
                      &lt;sch:msisdn&gt;65144099016324&lt;/msisdn&gt;
                  &lt;/sch:msisdns&gt;
              &lt;/sch:GetTerminalsByMsisdnRequest&gt;
          &lt;/S:Body&gt;
  </code></pre>