无内置函数的PHP SOAP客户端错误


PHP SOAP Client Error for none build-in functions

有一个wcf服务器,我正在尝试连接它并发送请求。

代码为:

$url = "http://serverip:8080/example.svc?wsdl";
$params = array(
 'Username' => 'username',
 'Password' => 'password'
);
 $client = new SoapClient($url);
 var_dump($client->__getTypes()); //it works
 $result = $client->Login($params); //gives error

但每次我都会遇到内部服务器错误。我花了5天的时间浏览了所有的网页,尝试了所有不同的方法,但我总是收到内部服务器错误。错误如下:

protected 'message' => string 'The server was unable to process ...
private 'string' (Exception) => string '' (length=0) ...

如果我使用SOAP UI,我可以发送和获取数据,或者如果我从php服务器调用"$client->__getTypes()",我就会获得类型。但是,如果我用PHP调用已实现的函数,它就不起作用。有人帮我吗?

非常感谢,

也许您应该像下面的示例那样将参数作为对象传递

try {
    $client = new SoapClient('http://serverip:8080/example.svc?wsdl');
    $params = new stdClass();
    $params->Username = 'Username';
    $params->Password = 'Password';
    $client->Login($params);
} catch (SoapFault $e) {
    // error handling
}