note 95576 added to soapclient.soapclient
| From: | Anonymous at osu1 dot php dot net | Date: | Sun, 10 Jan 2010 14:53:14 +0000 |
| Subject: | note 95576 added to soapclient.soapclient | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-164829@lists.php.net to get a copy of this message | ||
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
----
Server IP: 69.147.83.197
Probable Submitter: 69.172.108.25
----
Manual Page -- http://www.php.net/manual/en/soapclient.soapclient.php
Edit -- https://master.php.net/note/edit/95576
Del: integrated -- https://master.php.net/note/delete/95576/integrated
Del: useless -- https://master.php.net/note/delete/95576/useless
Del: bad code -- https://master.php.net/note/delete/95576/bad+code
Del: spam -- https://master.php.net/note/delete/95576/spam
Del: non-english -- https://master.php.net/note/delete/95576/non-english
Del: in docs -- https://master.php.net/note/delete/95576/in+docs
Del: other reasons-- https://master.php.net/note/delete/95576
Reject -- https://master.php.net/note/reject/95576
Search -- https://master.php.net/manage/user-notes.php