简体   繁体   English

如何从PHP Soap客户端调用重载的wsdl Webservice方法

[英]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, 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);
?>

It gives error GetSubscriberInfoVCLogV2 is not found. 它给出错误GetSubscriberInfoVCLogV2找不到。 I need to get the response of GetSubscriberInfoVCLogV2. 我需要获取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 . 唯一的方法是手动编写XML请求,并通过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. 将“ Web服务描述”页面中找到的MessageName更改为“ TheMessageNameGoesHere”。

The XML structure can also be found in the WebService description page, when you click in the function. 单击该函数时,也可以在WebService描述页面中找到XML结构。

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操作,可以在WSDL文件中作为标记<soap:operation>的属性找到。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM