5

I am trying to achieve below soap request,

<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">
   <soapenv:Header/>
   <soapenv:Body>
      <tap1:cusrequest> 
         <tap2:version>1.0.0</tap2:version>
         <tap2:msg>
           <tap2:id>1234566789</tap2:id>
           <tap2:msid>111</tap2:msid> 
         </tap2:msg>             
      </tap1:cusrequest>
   </soapenv:Body>
</soapenv:Envelope>

But I my request is:

<SOAP-ENV:Envelope SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<SOAP-ENV:Body>
  <cusrequest xsi:type="ns1:msg">
   <msg xsi:type="SOAP-ENC:Struct">
    <id xsi:type="xsd:string">1</id>
    <msid xsi:type="xsd:string">111</msid>
   </msg>
  </cusrequest></appid>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>

and I tried as below,

<?php
  ini_set("soap.wsdl_cache_enabled", 0);
  $client = new SoapClient('http://localhost/test/new_soap/server.php?wsdl', 
                                array('cache_wsdl' => WSDL_CACHE_NONE,
                                      'trace'=>TRUE,
                                      "exceptions" => 1,
                                      'soap_version' => SOAP_1_1
                                     )
                           );

  $tap1 = "http://www.loclhodd/test/services";
  $tap2 = "http://www.loclhodd/test/services";

  $messages = new stdClass();           
  $messages->id = '1';
  $messages->msid = '111'; 

  $custreqType = new stdClass();
  $custreqType->msg = $messages;
  $custreq = new SoapVar($custreqType, SOAP_ENC_OBJECT, "msg", $tap1);

  $soapRequestType = new stdClass();
  $soapRequestType->cusrequest = $custreq;
  $getRateAvailabilityReq = new SoapVar($soapRequestType, SOAP_ENC_OBJECT, "cusrequest", $tap1); 

 try {
    $product = $client->testRequest($getRateAvailabilityReq );
  } catch (SoapFault $e) {
     //print($client->__getLastResponse());
  } 

How can I achieve the expected request, what I need to update in the codebase

2
  • would you be able to share you WSDL here so that we have minimum reproducible example? Commented Nov 30, 2015 at 15:18
  • something like this maybe stackoverflow.com/questions/5998356/… Commented Dec 24, 2015 at 6:26

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.