title: How create SOAP request using SAAJ API
body: <p>I understand that I may be ask a trivial question, BUT was unable to properly create the required SOAP request format.</p>
  
  <p>SOAP request of this kind</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>         &lt;?xml version="1.0" encoding="UTF-8" ?&gt;
           &lt;SOAP:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"&gt;
           &lt;SOAP:Body&gt;
           &lt;GetParameter xmlns="http://examples/2001"&gt;
     &lt;request&gt;
           &lt;MonCode xmlns="http://newsite/mon"&gt;Latency&lt;/MonCode&gt;
     &lt;TimeFrom xmlns="http://newsite/mon"&gt;2016-10-26T11:00&lt;/TimeFrom&gt;
     &lt;TimeTo xmlns="http://newsite/mon"&gt;2016-10-26T12:00&lt;/TimeTo&gt;
           &lt;/request&gt;
     &lt;/GetParameter&gt;
           &lt;/SOAP:Body&gt;
           &lt;/SOAP:Envelope&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>I try to create SOAP request using SAAJ API by Java.
  I found some question:
  <a href="https://stackoverflow.com/questions/28570086/java-generate-soap-envelope">Java Generate SOAP Envelope</a></p>
  
  <p>and 
  <a href="https://stackoverflow.com/questions/15948927/working-soap-client-example">Working Soap client example</a></p>
  
  <p>BUT not understood, how create SOAP request for my event.</p>
  
  <p>Please help to create SOAP request. </p>
  
  <p>p.s. try this code</p>
  
  <pre><code>            MessageFactory messageFactory = MessageFactory.newInstance();
          SOAPMessage message = messageFactory.createMessage();
          SOAPPart soapPart = message.getSOAPPart();
          SOAPEnvelope envelope = soapPart.getEnvelope();
          envelope.addNamespaceDeclaration("xsd", "http://www.w3.org/2001/XMLSchema");
          envelope.addNamespaceDeclaration("xsi", "http://www.w3.org/2001/XMLSchema-instance");
          envelope.addNamespaceDeclaration("soap", "http://schemas.xmlsoap.org/soap/envelop/");
  
          SOAPBody body = message.getSOAPBody();
          SOAPElement bodyElement = body.addChildElement("GetParameter");
          bodyElement.setAttribute("xmlns", "http://examples/2001");
          bodyElement = body.addChildElement("request");
          SOAPElement paramsElement = bodyElement.addChildElement("MonCode");
          paramsElement.setAttribute("xmlns", "http://newsite/mon");
          paramsElement.addTextNode("Latency");
          paramsElement = bodyElement.addChildElement("TimeFrom");
          paramsElement.setAttribute("xmlns", "http://newsite/mon");
          paramsElement.addTextNode("2016-10-26T11:00");
          paramsElement = bodyElement.addChildElement("TimeTo");
          paramsElement.setAttribute("xmlns", "http://newsite/mon");
          paramsElement.addTextNode("2016-10-26T12:00");
  </code></pre>
  
  <p>BUT in result get SOAP request without value "<a href="http://examples/2001" rel="nofollow noreferrer">http://examples/2001</a>" "<a href="http://newsite/mon" rel="nofollow noreferrer">http://newsite/mon</a>".</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soap="http://schemas.xmlsoap.org/soap/envelop/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"&gt;&lt;SOAP-ENV:Header/&gt;
    &lt;SOAP-ENV:Body&gt;
      &lt;GetParameter xmlns=""/&gt;
      &lt;request&gt;
        &lt;MonCode xmlns=""&gt;Latency&lt;/MonCode&gt;
        &lt;TimeFrom xmlns=""&gt;2016-10-26T11:00&lt;/TimeFrom&gt;
        &lt;TimeTo xmlns=""&gt;2016-10-26T12:00&lt;/TimeTo&gt;
      &lt;/request&gt;
    &lt;/SOAP-ENV:Body&gt;
  &lt;/SOAP-ENV:Envelope&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>How to solve this problem?</p>