How to call overloaded wsdl webservice method from php soap client


How to call overloaded wsdl webservice method from php soap client



Webservice : http://webservices.dishtv.in/Services/Mobile/Trade/TradeSubscriberInfo.asmx
Overloaded method is GetSubscriberInfoV2 MessageName="GetSubscriberInfoVCLogV2"
My php code is,


<?php
$mobileno="01523833622";
$url="http://webservices.dishtv.in/Services/Mobile/Trade/TradeSubscriberInfo.asmx?wsdl";
$client = new SoapClient($url);
$soapHeader = array('UserID' => '47','Password' => 'zZa@#286#@');
$header = new SOAPHeader('http://tempuri.org/', 'AuthenticationHeader', $soapHeader);
$client ->__setSoapHeaders($header);
try
{
$res = $client->GetSubscriberInfoVCLogV2(array('vcNo' => $mobileno, 'mobileNo' => '', 'BizOps' => '1', 'UserID' => '555300', 'UserType' => 'DL' ));
}
catch(SoapFault $e)
{
echo "Invalid No";
print_r($e);
}
print_r($res);
?>



It gives error GetSubscriberInfoVCLogV2 is not found. I need to get the response of GetSubscriberInfoVCLogV2. Can anyone help me to find the solution.





check this with print_r($client->__getFunctions()); to see the available function list.
– Amila
Jul 4 '16 at 3:09





I have printed this, and got, GetExistingAlaCarteList GetExistingPackageList GetSubscriberInfo GetSubscriberInfoV2 GetSubscriberInfoV2. From this I want to consume last method, which is overloaded method with MessageName="GetSubscriberInfoVCLogV2"
– vmnpk
Jul 4 '16 at 5:22





1 Answer
1



The only way to do this is writing the XML request manually and sending it through the method SoapClient::__doRequest.


SoapClient::__doRequest



It would be something like this:


$request = <<<'EOT'
<?xml version="1.0" encoding="utf-8"?>
<SOAP-ENV:Envelope
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:ns1="http://tempuri.org/">
<SOAP-ENV:Body>
<ns1:TheMessageNameGoesHere>
<ns1:param1>$param1</ns1:param1>
<ns1:param2>$param2</ns1:param2>
<ns1:param3>$param3</ns1:param3>
</ns1:TheMessageNameGoesHere>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
EOT;

$response = $soapClient->__doRequest(
$request,
"http://www.exemple.com/path/to/WebService.asmx",
"http://tempuri.org/TheMessageNameGoesHere",
SOAP_1_1
);



Change "TheMessageNameGoesHere" for the MessageName found in the WebService description page.



The XML structure can also be found in the WebService description page, when you click in the function.



The third parameter of the method __doRequest is the SOAP action, and can be found in the WSDL file as an attribute of the tag <soap:operation>


__doRequest


<soap:operation>






By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Comments

Popular posts from this blog

paramiko-expect timeout is happening after executing the command

how to run turtle graphics in Colaboratory

Export result set on Dbeaver to CSV