简体   繁体   中英

PHP SOAP Client Error for none build-in functions

There is a wcf server and I am trying to connect it and send requests.

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. 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. But if I call implemented functions with PHP it doesn't work. 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
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM