我正在使用PHP SoapClient
对下面的URL使用soap调用请求。
https://stagingxml.tamarindtours.in/Version1.0/BaseDetails.svc?wsdl
我使用了以下代码。
$HeaderSecurity = array("UsernameToken"=>array("Username"=>"xxx",
"Password"=>"xxx",
)
);
$client = new SoapClient('https://stagingxml.tamarindtours.in/Version1.0/BaseDetails.svc?wsdl',array('trace' => 1));
$header[] = new SoapHeader("http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd","Security",$HeaderSecurity);
$client->__setSoapHeaders($header);
//$client->__setLocation("https://YourTargetLocation/"); if you have wsdl file you don't need to use this line
$REsponse = $client->GetCountries();
我收到了以下错误。
你能帮帮我吗?感谢。致命错误:未捕获的SoapFault异常:[a:InvalidSecurity] An 验证邮件的安全性时发生错误。在 /opt/lampp/htdocs/wssoap.php:148堆栈跟踪:#0 /opt/lampp/htdocs/wssoap.php(148):SoapClient-> __ call('GetCountries', 数组)#1 /opt/lampp/htdocs/wssoap.php(148): SoapClient-> GetCountries()#2 {main}引入 第148行的/opt/lampp/htdocs/wssoap.php
答案 0 :(得分:0)
服务器可能包含无效的SSL证书。
如果此错误对您不重要,请尝试忽略SSL证书检查,如下所述:https://stackoverflow.com/a/8447706/911718(请参阅评论allow_self_signed
选项)
编辑:与您相同的错误&错误在https://stackoverflow.com/a/16794759/911718
解决