【发布时间】:2016-06-16 08:33:32
【问题描述】:
此请求:
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<Buy xmlns="http://tempuri.org/">
<perf>
<param1>1111</param1>
<param2>2222</param2>
</perf>
</Buy>
</soap:Body></soap:Envelope>
我使用 SoapClient 创建请求:
$client = new SoapClient("http://0.0.0.0:8080/Service1.asmx?wsdl",
array(
'trace' => true,
'exceptions'=>true
));
函数“getTypes”和“getFunctions”工作正常
$types = $client->__getTypes();
$functions = $client->__getFunctions ();
我正在创建对象,正在等待结果:
$std = new stdClass();
$std->param1 = '1111';
$std->param2 = '2222';
ini_set("soap.wsdl_cache_enabled", "0"); // disallow cache WSDL
$result = $client->Buy( array('perf' => $std ) );
var_dump($result); exit;
我收到一个错误:SoapFault:
Fatal error: Uncaught SoapFault exception: [HTTP] Could not connect to host in /var/www/index.php:86 Stack trace: #0 [internal function]: SoapClient->__doRequest('__call('Buy', Array) #2 /var/www/index.php(86): SoapClient->Buy(Array) #3 {main} thrown in /var/www/index.php on line 86
在apache的日志中:
PHP Fatal error: Uncaught SoapFault exception: [HTTP] Could not connect to host in /var/www/index.php:86\nStack trace:\n#0 [internal function]: SoapClient->__doRequest('<?xml version="...', 'http://0.0.0...', 'http://tempuri....', 1, 0)\n#1 /var/www/index.php(86): SoapClient->__call('Buy', Array)\n#2 /var/www/index.php(86): SoapClient->Buy(Array)\n#3 {main}\n thrown in /var/www/index.php on line 86
请帮帮我),可能是我创建的对象参数不正确?
【问题讨论】:
标签: php soap wsdl soap-client