PHP SoapClient request: not a valid method for this service

孤街醉人 提交于 2019-11-29 03:07:22

问题


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 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

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>";

回答1:


A simple request for the web service's available functions solved the problem.

$functions = $client->__getFunctions ();
var_dump ($functions);

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)" } 



回答2:


I assume you're not typo and the method is actually available.

Try this

ini_set("soap.wsdl_cache_enabled", "0");

It's might be because of wsdl was cached.



来源:https://stackoverflow.com/questions/10817430/php-soapclient-request-not-a-valid-method-for-this-service

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!