How to call overloaded wsdl webservice method from php soap client(如何从 php soap 客户端调用重载的 wsdl webservice 方法)
问题描述
网络服务:http://webservices.dishtv.in/Services/Mobile/Trade/TradeSubscriberInfo.asmx重载方法是 GetSubscriberInfoV2 MessageName="GetSubscriberInfoVCLogV2"我的 php 代码是,
'47','Password' => 'zZa@#286#@');$header = new SOAPHeader('http://tempuri.org/', 'AuthenticationHeader', $soapHeader);$client ->__setSoapHeaders($header);尝试{$res = $client->GetSubscriberInfoVCLogV2(array('vcNo' => $mobileno, 'mobileNo' => '', 'BizOps' => '1', 'UserID' => '555300','用户类型' => 'DL' ));}抓住(SoapFault $e){echo "无效否";打印_r($e);}打印_r($res);?>
它给出了错误 GetSubscriberInfoVCLogV2 is not found.我需要得到 GetSubscriberInfoVCLogV2 的响应.谁能帮我找到解决方案.
做到这一点的唯一方法是手动编写 XML 请求并通过方法 SoapClient::__doRequest
发送它.
应该是这样的:
$request = <<<'EOT'<?xml version="1.0" encoding="utf-8"?><SOAP-ENV:信封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($请求,"http://www.exemple.com/path/to/WebService.asmx","http://tempuri.org/TheMessageNameGoesHere",肥皂_1_1);
为 WebService 描述页面中的 MessageName 更改TheMessageNameGoesHere".
XML 结构也可以在 WebService 描述页面中找到,当您在函数中单击时.
方法__doRequest
的第三个参数是SOAP动作,可以在WSDL文件中作为标签
<的属性找到/p>
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.
The only way to do this is writing the XML request manually and sending it through the method 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>
这篇关于如何从 php soap 客户端调用重载的 wsdl webservice 方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:如何从 php soap 客户端调用重载的 wsdl webservice 方


- 没有作曲家的 PSR4 自动加载 2022-01-01
- 如何定位 php.ini 文件 (xampp) 2022-01-01
- 从 PHP 中的输入表单获取日期 2022-01-01
- Oracle 即时客户端 DYLD_LIBRARY_PATH 错误 2022-01-01
- 带有通配符的 Laravel 验证器 2021-01-01
- 正确分离 PHP 中的逻辑/样式 2021-01-01
- SoapClient 设置自定义 HTTP Header 2021-01-01
- PHP Count 布尔数组中真值的数量 2021-01-01
- Laravel 仓库 2022-01-01
- Mod使用GET变量将子域重写为PHP 2021-01-01