基于WSDL的Saop Api使用SoapClient身份验证问题

时间:2016-08-24 10:02:47

标签: authentication soap wsdl soap-client

您好我必须点击Bank SOAP API。 WSDL文件是: https://87.101.136.187/AdahiAgentsOrders/OrderService.svc?wsdl 我的代码是:

items list
    $orderDetail = $this->getOrderDetail();
    // soap request
    ini_set("soap.wsdl_cache_enabled", "0");


    // set auth header
    $obj = new stdClass();
    $obj->Username = $this->username;
    $obj->Password = $this->password;
    $header =  new SoapHeader('http://tempuri.org/', "Authentication",$obj,false);
  

使用SoapVar进行OR头设置

$credentials = array('Username' => $this->username, 'Password' => $this->password);   
$auth_object = new SoapVar($credentials, SOAP_ENC_OBJECT);
$header =  new SoapHeader('http://tempuri.org/', "Authentication", $auth_object,false);


//Create the client object
$soapOptions = array("trace" => 1,"exceptions" => 0,'encoding' => 'UTF-8');
$soapClient = new SoapClient('https://87.101.136.187/AdahiAgentsOrders/OrderService.svc?wsdl',$soapOptions);
//set header
$soapClient->__setSoapHeaders(array($header));
//Use the functions of the client, the params of the function are in
$params = array('AgentId'=>$this->agentId,'MessageId' => $messageId,'Signature'=>$signature,'OrderItems'=>$orderDetail);
$response = $soapClient->UploadOrder($params);
echo '<pre>';print_r($response);exit;

两种方法都不起作用。哪里错了?得到错误 &#34;验证邮件的安全性时发生错误。&#34;

0 个答案:

没有答案