[英]PHP SOAP Client Error for none build-in functions
There is a wcf server and I am trying to connect it and send requests. 有一个wcf服务器,我正在尝试连接它并发送请求。
The code is : 代码是:
$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
But everytime I am getting internal server error. 但是,每当我收到内部服务器错误时。 I spend 5 days and searhed all the web and tried all different methods but I am always getting internal server error.
我花了5天的时间在所有网络上搜索并尝试了所有不同的方法,但是我总是遇到内部服务器错误。 Error is below :
错误如下:
protected 'message' => string 'The server was unable to process ...
private 'string' (Exception) => string '' (length=0) ...
If I use SOAP UI I can send and get data or if I call "$client->__getTypes()" from php server, I get types. 如果我使用SOAP UI,则可以发送和获取数据,或者如果我从php服务器调用“ $ client-> __ getTypes()”,则可以获取类型。 But if I call implemented functions with PHP it doesn't work.
但是,如果我用PHP调用已实现的函数,它将无法正常工作。 Are there anyone to help me?
有没有人可以帮助我?
Thanks a lot, 非常感谢,
Perhaps you should pass the parameters as object as in the following example 也许您应该像下面的示例一样将参数作为对象传递
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
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.