当我使用SoapUI测试这个WSDL时,我得到了真实的结果,它只是增加了数字:
$client = new SoapClient("http://localhost:8080/calculator?wsdl");
$result = $client->add(3,3);
print_r($result);
返回:
stdClass Object
(
[return] => 0
)
但是应该返回6. 和SoapUI一样。
一些调试:
print_r($client->__getFunctions());
print_r($client->__getTypes());
Array
(
[0] => addResponse add(add $parameters)
)
Array
(
[0] => struct add {
int arg0;
int arg1;
}
[1] => struct addResponse {
int return;
}
)
答案 0 :(得分:2)
addResponse
只需要一个参数,因此您需要在数组或对象中传递它:
$params = array(
'arg0' => 3,
'arg1' => 3
);
//OR
//$params = new stdClass;
//$params->arg0 = 3;
//$params->arg1 = 3;
$result = $client->add($params);