問題描述
好吧,我想我需要另一雙眼睛來看看這個(gè).我正在對遠(yuǎn)程服務(wù)器上的 echo Web 服務(wù)進(jìn)行簡單的 php soapclient 調(diào)用.我很確定我沒有任何錯(cuò)別字并且函數(shù)調(diào)用是正確的.但是,我收到一個(gè)致命錯(cuò)誤,聲稱該函數(shù)不是有效方法.以下是 Web 服務(wù)類型的 var_dump.
Okay, I think I need another pair of eyes to look over this. I'm making a simple php soapclient call to an echo web service on a remote server. I'm pretty sure I don't have any typos and that the function call is correct. However, I'm receiving a fatal error claiming the function isn't a valid method. Below is a var_dump of the web services types.
array(4) { [0]=> string(88) "struct EspException { string Code; string Audience; string Source; string Message; }" [1]=> string(71) "struct ArrayOfEspException { string Source; EspException 異常; }" [2]=> string(43) "struct EchoTestRequest { string ValueIn; }" [3]=> string(45) "struct EchoTestResponse { string ValueOut; }" }
array(4) { [0]=> string(88) "struct EspException { string Code; string Audience; string Source; string Message; }" [1]=> string(71) "struct ArrayOfEspException { string Source; EspException Exception; }" [2]=> string(43) "struct EchoTestRequest { string ValueIn; }" [3]=> string(45) "struct EchoTestResponse { string ValueOut; }" }
致命錯(cuò)誤:未捕獲的 SoapFault 異常:[Client] 函數(shù)(EchoTestRequest")不是/home/grafixst/public_html/cpaapp/echo_test.php:38 中此服務(wù)的有效方法:#0/home/grafixst/public_html/cpaapp/echo_test.php(38): SoapClient->__call('EchoTestRequest', Array) #1/home/grafixst/public_html/cpaapp/echo_test.php(38): SoapClientAuth->EchoTestRequest(Array) #2 {main} 在第 38 行的/home/grafixst/public_html/cpaapp/drew/echo_test.php 中拋出
Fatal error: Uncaught SoapFault exception: [Client] Function ("EchoTestRequest") is not a valid method for this service in /home/grafixst/public_html/cpaapp/echo_test.php:38 Stack trace: #0 /home/grafixst/public_html/cpaapp/echo_test.php(38): SoapClient->__call('EchoTestRequest', Array) #1 /home/grafixst/public_html/cpaapp/echo_test.php(38): SoapClientAuth->EchoTestRequest(Array) #2 {main} thrown in /home/grafixst/public_html/cpaapp/drew/echo_test.php on line 38
這是我用來撥打電話的代碼:
Here is the code I'm using to make the call:
require_once('SoapClientAuth.php');
ini_set("soap.wsdl_cache_enabled", "0");
#- Loading the WSDL document
$server = "https://wsonline.seisint.com/WsAccurint/EchoTest?ver_=1.65";
$wsdl = $server . "&wsdl";
$client = new SoapClientAuth($wsdl,
array(
'login' => $username,
'password' => $password
));
$types = $client->__getTypes();
var_dump($types);
echo "</br>";
$req = $client->EchoTestRequest(array('ValueIn' => 'echo'));
print $req->ValueOut;
echo "</br>";
推薦答案
一個(gè)對 Web 服務(wù)可用功能的簡單請求解決了這個(gè)問題.
A simple request for the web service's available functions solved the problem.
$functions = $client->__getFunctions ();
var_dump ($functions);
EchoTestRequest 不是有效的函數(shù)調(diào)用.正確的函數(shù)調(diào)用是 EchoTest,由函數(shù)變量 dump 說明.
EchoTestRequest was not a valid function call. The proper function call was EchoTest, which is illustrated by the functions variable dump.
array(1) { [0]=> string(54) "EchoTestResponse EchoTest(EchoTestRequest $parameters)" }
這篇關(guān)于PHP SoapClient 請求:不是此服務(wù)的有效方法的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!