3个答案
php有内置的函数__getFunctions ():
-
0 => string 'UNKNOWN getOrderList()' (length=22)
1 => string 'UNKNOWN addOrder(UNKNOWN $data, string $t)' (length=42)
2 => string 'UNKNOWN delOrder(UNKNOWN $data)' (length=31)
返回的结果节选如上,我觉得上面这些字符串还是挺难处理,因为目前我只需要那个方法名就OK了,是不是应该写个正则来匹配? – 黄远威 2012-08-27
以下为我们最近接口的一个例子,这个例子的特点是应用了WSDL中的Header安全参数:
- <?php
- $soapClient = new SoapClient("http://*****.wsdl",array('encoding' => 'UTF-8'));
- $sh_param = array(
- 'Username' => '***',
- 'Password' => '***');
- $headers = new SoapHeader('http://soapserver.example.com/webservices', 'UserCredentials', $sh_param);
-
- // Prepare Soap Client
- $soapClient->__setSoapHeaders(array($headers));
- $body_param = array(
- 'ID' => '***',
- 'AAID' => '0',
- );
- $result = $soapClient->FUNCTIONS($body_param);
-
- print_r($result);
- exit;
- ?>