note 95576 deleted from soapclient.soapclient by crell
| From: | crell@php.net | Date: | Mon, 04 Apr 2022 16:49:28 +0000 |
| Subject: | note 95576 deleted from soapclient.soapclient by crell | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-218071@lists.php.net to get a copy of this message | ||
Note Submitter: Anonymous
----
I had to struggle with a rather strange behavior when trying to consume standard Parlay X web
services with no success. However, I found a remedy to my problem.
The problem which I faced was about an erroneous invalid HTTP basic authentication request sent to
the web service. Although I was sending the right credentials, I was getting an authentication
error. It turns out that PHP was sending HTTP requests to another endpoint which is not exposed
directly through the web service and that end point does not require authentication.
My remedy for that issue was by using this simple lines in the example of using sendSms Paraly-X
method.
First, creating a soap client without any HTTP authentication options:
<?php
$client = new SoapClient($wsdl_url);
?>
The above request will cache the wsdl in the /tmp directory. Immediately after this construction we
create another soap client, this time with HTTP authentication options:
<?php
try {
$client = new SoapClient($wsdl_url, array('login' => "griffin",
'password' => "password"));
} catch (Exception $e) {
printf("Error:sendSms: %s\n",$e->__toString());
return false;
}
?>
Now it should work without any problem. Without the second call, PHP will call sendSms without
credentials resulting in a failed attempt due to missing authentication information. I found this
procedure to be the simplest.
This process should be done every time the cached wsdl expires, or simply a one can increase the
time-to-live for the cached wsdl from php.ini