0
votes

I am using soap call request to below URL using PHP SoapClient.

https://stagingxml.tamarindtours.in/Version1.0/BaseDetails.svc?wsdl

I have used follwing code.

$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();

I am getting following error.

Fatal error: Uncaught SoapFault exception: [a:InvalidSecurity] An error occurred when verifying security for the message. in /opt/lampp/htdocs/wssoap.php:148 Stack trace: #0 /opt/lampp/htdocs/wssoap.php(148): SoapClient->__call('GetCountries', Array) #1 /opt/lampp/htdocs/wssoap.php(148): SoapClient->GetCountries() #2 {main} thrown in /opt/lampp/htdocs/wssoap.php on line 148

Can you please help me out? Thanks.

1
I'd check the actual request and response. Use the __get* functions made available via "trace=true". Also, but that may be a red herring, I never had to use __setSoapHeaders(), even when using HTTPS!Ulrich Eckhardt

1 Answers

0
votes

Server may have an invalid SSL certificate.

If this error is not important for you, try to ignore SSL certificate check as explained here : https://stackoverflow.com/a/8447706/911718 (see comments too about allow_self_signed option)

Edit : Same error as you & error solved at https://stackoverflow.com/a/16794759/911718