#48499 [Opn->Fbk]: setting Soap Headers before calling WSDL
ID: 48499
Updated by: sjoerd@php.net
Reported By: crazytonyi at yahoo dot com
-Status: Open
+Status: Feedback
Bug Type: Documentation problem
Operating System: SunOS
PHP Version: Irrelevant
Previous Comments:
------------------------------------------------------------------------
[2009-06-23 20:53:54] sjoerd-php at linuxonly dot nl
Thank you for your bug report.
Does the script fail when calling the SoapClient constructor? Do you
pass an URL to a WSDL as the first parameter to the SoapClient? This
does not show from your example. If the WSDL requires authentication, it
is probably HTTP authentication, not SOAP authentication. For HTTP
authentication, the login and password options can be used to supply
credentials to the SoapClient constructor.
------------------------------------------------------------------------
[2009-06-08 19:53:46] crazytonyi at yahoo dot com
Description:
------------
I can not set my authentication header at the same time as I set my
client. Because of this, I get a fatal error at the point where the
client is set, before the headers can be set. Because the service uses
the header for authentication, I cannot get to the service.
As a workaround/test, I moved the contents of the service (which I
accessed through a browser, requiring me to login), and pointed the
client to the local version. This works great. Obviously not ideal.
If I use NULL as my service URL and set the location and uri, this
almost seems to work, except then I am in non-WSDL mode, and none of
the get methods work.
I tried setting it as non-WSDL and using setLocation after setting the
headers, no luck. All I get is NULL for getFunctions().
So is it possible to set the headers at the same time as setting the
client? If so, this would be very helpful in the documentation. If
not, a link to the correct method for doing so would be great.
Reproduce code:
---------------
---
From manual page: soapclient.setsoapheaders
---
$service = "servicetest.xml";
$namespace = "urn:NameOfService";
$client = new SoapClient($service);
$authHeaders["login"] = "user";
$authHeaders["password"] = "password";
$header=new SoapHeader($namespace ,'Authentication',
$authHeaders);
$client->__setSoapHeaders($header);
var_dump($client->__getFunctions());
Expected result:
----------------
A list of functions for that service.
Actual result:
--------------
When pointing to remote service:
Fatal error: Uncaught SoapFault exception: [WSDL] SOAP-ERROR: Parsing
WSDL: Couldn't load from 'path/to/service' in /path/to/myscript.php:6
Stack trace: #0 /path/to/myscript.php(6): SoapClient-
>SoapClient('https://path/to/serv...') #1
>{main} thrown in
/path/to/myscript.php on line 6
When pointing to local copy of service:
A list of functions for that service.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=48499&edit=1
Thread (3 messages)