好吧,我想我需要另一雙眼睛來看看這個。我正在對遠程服務器上的echo web服務進行簡單的php soapclient調用。我很確定我沒有任何錯別字,並且函數調用是正確的。但是,我收到一個致命錯誤,聲稱該函數不是有效的方法。以下是Web服務類型的var_dump。PHP SoapClient請求:不是此服務的有效方法
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; }" }
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
這裏是我使用撥打電話代碼:
<?php
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>";
?>
這節省了我的一天!如果某個函數在WSDL中列出但不能調用,請檢查此答案,因爲它會顯示所有可用的函數。 – diynevala
在意識到該方法不在列表中後,我將「?v = 1」添加到wsdl url,並且新的wsdl使用了新的方法加載。 – wormhit
我遇到了類似的問題,並嘗試了你的答案,修復了WSDL文件。 var_dump()仍然會給出相同的結果。原來它也在緩存WSDL文件。所以你的答案與[這個答案](http://stackoverflow.com/questions/303488/in-php-how-can-you-clear-a-wsdl-cache)解決了這個問題。謝謝。 –