来自 PHP 的 SOAP 请求不起作用 [英] SOAP Request from PHP is not working
问题描述
我有一个可用的网络服务@http://www.xxxxx/zzzzzzzz/service.asmx 并且我正在尝试使用两个参数发送方法 - some_function
的 SOAP 请求,但仍然无法通过连接.
这是我的代码:
'XXXX','contrasena'=>'YYYYYY');$client = new SoapClient("http://www.xxxxx/zzzzzzzz/service.asmx?wsdl");$result = $client->__soapCall('some_function', $param);打印 $result;?>
我得到的错误是:
<块引用>致命错误:未捕获的 SoapFault 异常:[soap:Server] 服务器无法处理请求.---> 未将对象引用设置为对象的实例.在/home/zzzz/XXXXXXXXXX.com/uni/index.php:6 堆栈跟踪:#0/home/zzzz/XXXXXXXXXX.com/uni/index.php(6): SoapClient->__soapCall('some_function' , Array) #1 {main} 在第 6 行的/home/zzzz/XXXXXXXXXX.com/uni/index.php 中抛出
请提出更正建议.非常感谢 :)
谢谢@dootzky &@卢尔科.我已经解决了这个问题.下面的代码对我来说非常好:
1));尝试 {echo "\n";$result = $client->SOME_FUNCTION(array("request" => array("cedula" => $login_id, "contrasena" => $password)))print_r($result);回声 "\n";}捕获(SoapFault $exception){回声 $exception;}?>
I have a web service available @ http://www.xxxxx/zzzzzzzz/service.asmx and I am trying to send a SOAP request for method - some_function
with both the parameters but still not able to get the connection through.
This is my code:
<?php
$param = array('cedula'=>'XXXX','contrasena'=>'YYYYYY');
$client = new SoapClient("http://www.xxxxx/zzzzzzzz/service.asmx?wsdl");
$result = $client->__soapCall('some_function', $param);
print $result;
?>
Error that I'm getting is:
Fatal error: Uncaught SoapFault exception: [soap:Server] Server was unable to process request. ---> Object reference not set to an instance of an object. in /home/zzzz/XXXXXXXXXX.com/uni/index.php:6 Stack trace: #0 /home/zzzz/XXXXXXXXXX.com/uni/index.php(6): SoapClient->__soapCall('some_function' , Array) #1 {main} thrown in /home/zzzz/XXXXXXXXXX.com/uni/index.php on line 6
Please suggest the corrections. Many thanks in advance :)
Thanks @dootzky & @lulco. I have solved this. Code below works perfectly fine for me:
<?php
ini_set("soap.wsdl_cache_enabled", "0"); // disabling WSDL cache
$wsdl_path = "http://www.xxxxxxx/zzzzzzzzzz/service.asmx?WSDL";
$login_id = 'XXXX';
$password = 'YYYYYY';
$client = new SoapClient($wsdl_path, array('trace' => 1));
try {
echo "<pre>\n";
$result = $client->SOME_FUNCTION(array("request" => array("cedula" => $login_id, "contrasena" => $password)))
print_r($result);
echo "\n";
}
catch (SoapFault $exception) {
echo $exception;
}
?>
这篇关于来自 PHP 的 SOAP 请求不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!