[英]How to call overloaded wsdl webservice method from php soap client
web服務 : http://webservices.dishtv.in/Services/Mobile/Trade/TradeSubscriberInfo.asmx重載方法是GetSubscriberInfoV2 MessageName = “GetSubscriberInfoVCLogV2”我的PHP代碼是,
<?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);
?>
它給出錯誤GetSubscriberInfoVCLogV2找不到。 我需要獲取GetSubscriberInfoVCLogV2的響應。 誰能幫我找到解決方案。
唯一的方法是手動編寫XML請求,並通過SoapClient::__doRequest
方法發送它。
就像這樣:
$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
);
將“ Web服務描述”頁面中找到的MessageName更改為“ TheMessageNameGoesHere”。
單擊該函數時,也可以在WebService描述頁面中找到XML結構。
方法__doRequest
的第三個參數是SOAP操作,可以在WSDL文件中作為標記<soap:operation>
的屬性找到。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.