如何从PHP Soap客户端调用重载的wsdl Webservice方法 [英] How to call overloaded wsdl webservice method from php soap client
问题描述
Web服务: http://webservices.dishtv .in/Services/Mobile/Trade/TradeSubscriberInfo.asmx 重载的方法是GetSubscriberInfoV2 MessageName ="GetSubscriberInfoVCLogLog2" 我的php代码是
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);
?>
给出错误GetSubscriberInfoVCLogV2.我需要获取GetSubscriberInfoVCVCV2的响应.谁能帮我找到解决方案.
It gives error GetSubscriberInfoVCLogV2 is not found. I need to get the response of GetSubscriberInfoVCLogV2. Can anyone help me to find the solution.
推荐答案
执行此操作的唯一方法是手动编写XML请求并通过方法SoapClient::__doRequest
发送.
The only way to do this is writing the XML request manually and sending it through the method 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
);
更改在WebService描述页面中找到的MessageName的"TheMessageNameGoesHere".
Change "TheMessageNameGoesHere" for the MessageName found in the WebService description page.
当您单击该函数时,也可以在WebService描述页面中找到XML结构.
The XML structure can also be found in the WebService description page, when you click in the function.
方法__doRequest
的第三个参数是SOAP操作,可以在WSDL文件中作为标记<soap:operation>
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>
这篇关于如何从PHP Soap客户端调用重载的wsdl Webservice方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!