Fatal error: Uncaught SoapFault exception: [ns1:Client.AUTH_1] Authentication Failed

前端 未结 2 1543
我寻月下人不归
我寻月下人不归 2021-01-22 13:12

In my wsdl file I have a user authentication block:



    
        

        
2条回答
  •  既然无缘
    2021-01-22 13:56

    You're passing your request data inside options for SoapClient instead of as parameters to the soap call.

    The code should look like this (assuming the soap call is Authenticate):

    $client = new SoapClient("http://api.example.com/v2/example?wsdl");
    
    $response = $client->Authenticate(Array(
       'iId' => 123456, 
       'sPassword' => 'fhfhfhfhfhfhfh46464dtdts64iyiyi', 
       'sType' => 'ghfh57477gghdkskdk68585jghhddhdghds'));
       ));
    

    And, in any event, you should use try..catch to prevent exceptions from crashing your code.

    try
    {
       // code here
    }
    catch(Exception $e)
    {
       // error handling goes here
       die("Error: ". $e->getMessage()."\n");
    }
    

提交回复
热议问题