title: How to create Soap Request with namespace in php
body: <p>I am trying to achieve below soap request,</p>
  
  <pre><code>&lt;soapenv:Envelope 
  xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" 
  xmlns:tap1="http://www.loclhodd/test/services" 
  xmlns:tap2="http://www.loclhodd`enter code here`/test2/services"&gt;
     &lt;soapenv:Header/&gt;
     &lt;soapenv:Body&gt;
        &lt;tap1:cusrequest&gt; 
           &lt;tap2:version&gt;1.0.0&lt;/tap2:version&gt;
           &lt;tap2:msg&gt;
             &lt;tap2:id&gt;1234566789&lt;/tap2:id&gt;
             &lt;tap2:msid&gt;111&lt;/tap2:msid&gt; 
           &lt;/tap2:msg&gt;             
        &lt;/tap1:cusrequest&gt;
     &lt;/soapenv:Body&gt;
  &lt;/soapenv:Envelope&gt;
  </code></pre>
  
  <p>But I my request is:</p>
  
  <pre><code>&lt;SOAP-ENV:Envelope SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"&gt;
  &lt;SOAP-ENV:Body&gt;
    &lt;cusrequest xsi:type="ns1:msg"&gt;
     &lt;msg xsi:type="SOAP-ENC:Struct"&gt;
      &lt;id xsi:type="xsd:string"&gt;1&lt;/id&gt;
      &lt;msid xsi:type="xsd:string"&gt;111&lt;/msid&gt;
     &lt;/msg&gt;
    &lt;/cusrequest&gt;&lt;/appid&gt;
  &lt;/SOAP-ENV:Body&gt;
  &lt;/SOAP-ENV:Envelope&gt;
  </code></pre>
  
  <p>and I tried as below,</p>
  
  <pre><code>&lt;?php
    ini_set("soap.wsdl_cache_enabled", 0);
    $client = new SoapClient('http://localhost/test/new_soap/server.php?wsdl', 
                                  array('cache_wsdl' =&gt; WSDL_CACHE_NONE,
                                        'trace'=&gt;TRUE,
                                        "exceptions" =&gt; 1,
                                        'soap_version' =&gt; SOAP_1_1
                                       )
                             );
  
    $tap1 = "http://www.loclhodd/test/services";
    $tap2 = "http://www.loclhodd/test/services";
  
    $messages = new stdClass();           
    $messages-&gt;id = '1';
    $messages-&gt;msid = '111'; 
  
    $custreqType = new stdClass();
    $custreqType-&gt;msg = $messages;
    $custreq = new SoapVar($custreqType, SOAP_ENC_OBJECT, "msg", $tap1);
  
    $soapRequestType = new stdClass();
    $soapRequestType-&gt;cusrequest = $custreq;
    $getRateAvailabilityReq = new SoapVar($soapRequestType, SOAP_ENC_OBJECT, "cusrequest", $tap1); 
  
   try {
      $product = $client-&gt;testRequest($getRateAvailabilityReq );
    } catch (SoapFault $e) {
       //print($client-&gt;__getLastResponse());
    } 
  </code></pre>
  
  <p>How can I achieve the expected request, what I need to update in the codebase</p>