php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #48499 setting Soap Headers before calling WSDL
Submitted: 2009-06-08 19:53 UTC Modified: 2009-09-19 01:00 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: crazytonyi at yahoo dot com Assigned:
Status: No Feedback Package: Documentation problem
PHP Version: Irrelevant OS: SunOS
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: crazytonyi at yahoo dot com
New email:
PHP Version: OS:

 

 [2009-06-08 19:53 UTC] 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.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-06-23 20:53 UTC] 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-09-19 01:00 UTC] doc-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Mar 29 13:01:29 2024 UTC