title: how to create a soap request for client saaj of given xml
body: <p>I am new to <code>SOAP</code>. I want to create a <code>soap</code> request of given below <code>xml</code>.</p>
  
  <p><strong>xml</strong></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; 
          &lt;soap:Envelope xmlns:soap="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;SendRequest xmlns="http://tempuri.org/"&gt; 
          &lt;request xsi:type="RegisterCheckRequest" Id="7a646d45-ee2f-4b1c-8de8-780c416fbbd0" Service="42" xmlns="http://paygo24.com/v3/protocol"&gt; 
          &lt;PaymentParameters xmlns=""&gt; 
          &lt;Parameter Name="account" Value="08374829" /&gt; 
          &lt;/PaymentParameters&gt; 
          &lt;/request&gt; 
          &lt;pointId&gt;46&lt;/pointId&gt; 
          &lt;password&gt;4QrcOUm6Wau+VuBX8g+IPg==&lt;/password&gt;
           &lt;/SendRequest&gt;
            &lt;/soap:Body&gt; 
            &lt;/soap:Envelope&gt;
  </code></pre>
  
  <p>I was using below sample java file, to create soap request but I am not able to do so, can anyone give me support.</p>
  
  <p><strong>Sample Java File to create soap request</strong></p>
  
  <pre><code>import javax.xml.soap.*;
  
  public class SOAPClientSAAJ {
  
      public static void main(String args[]) throws Exception {
          // Create SOAP Connection
          SOAPConnectionFactory soapConnectionFactory = SOAPConnectionFactory.newInstance();
          SOAPConnection soapConnection = soapConnectionFactory.createConnection();
  
          // Send SOAP Message to SOAP Server
          String url = "http://ws.cdyne.com/emailverify/Emailvernotestemail.asmx";
          SOAPMessage soapResponse = soapConnection.call(createSOAPRequest(), url);
  
          // print SOAP Response
          System.out.print("Response SOAP Message:");
          soapResponse.writeTo(System.out);
  
          soapConnection.close();
      }
  
      private static SOAPMessage createSOAPRequest() throws Exception {
          MessageFactory messageFactory = MessageFactory.newInstance();
          SOAPMessage soapMessage = messageFactory.createMessage();
          SOAPPart soapPart = soapMessage.getSOAPPart();
  
          String serverURI = "http://ws.cdyne.com/";
  
          // SOAP Envelope
          SOAPEnvelope envelope = soapPart.getEnvelope();
          envelope.addNamespaceDeclaration("example", serverURI);
  
          /*
          Constructed SOAP Request Message:
          &lt;SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:example="http://ws.cdyne.com/"&gt;
              &lt;SOAP-ENV:Header/&gt;
              &lt;SOAP-ENV:Body&gt;
                  &lt;example:VerifyEmail&gt;
                      &lt;example:email&gt;mutantninja@gmail.com&lt;/example:email&gt;
                      &lt;example:LicenseKey&gt;123&lt;/example:LicenseKey&gt;
                  &lt;/example:VerifyEmail&gt;
              &lt;/SOAP-ENV:Body&gt;
          &lt;/SOAP-ENV:Envelope&gt;
           */
  
          // SOAP Body
          SOAPBody soapBody = envelope.getBody();
          SOAPElement soapBodyElem = soapBody.addChildElement("VerifyEmail", "example");
          SOAPElement soapBodyElem1 = soapBodyElem.addChildElement("email", "example");
          soapBodyElem1.addTextNode("mutantninja@gmail.com");
          SOAPElement soapBodyElem2 = soapBodyElem.addChildElement("LicenseKey", "example");
          soapBodyElem2.addTextNode("123");
  
          MimeHeaders headers = soapMessage.getMimeHeaders();
          headers.addHeader("SOAPAction", serverURI  + "VerifyEmail");
  
          soapMessage.saveChanges();
  
          /* Print the request message */
          System.out.print("Request SOAP Message:");
          soapMessage.writeTo(System.out);
          System.out.println();
  
          return soapMessage;
      }
  
  }
  </code></pre>