#48499 [NEW]: setting Soap Headers before calling WSDL

From: Date: Mon, 08 Jun 2009 19:53:46 +0000
Subject: #48499 [NEW]: setting Soap Headers before calling WSDL
Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-2355@lists.php.net to get a copy of this message
From:             crazytonyi at yahoo dot com
Operating system: SunOS
PHP version:      Irrelevant
PHP Bug Type:     Documentation problem
Bug description:  setting Soap Headers before calling WSDL

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 bug report at http://bugs.php.net/?id=48499&edit=1
-- 
Try a CVS snapshot (PHP 5.2):        http://bugs.php.net/fix.php?id=48499&r=trysnapshot52
Try a CVS snapshot (PHP 5.3):        http://bugs.php.net/fix.php?id=48499&r=trysnapshot53
Try a CVS snapshot (PHP 6.0):        http://bugs.php.net/fix.php?id=48499&r=trysnapshot60
Fixed in CVS:                        http://bugs.php.net/fix.php?id=48499&r=fixedcvs
Fixed in CVS and need be documented: http://bugs.php.net/fix.php?id=48499&r=needdocs
Fixed in release:                    http://bugs.php.net/fix.php?id=48499&r=alreadyfixed
Need backtrace:                      http://bugs.php.net/fix.php?id=48499&r=needtrace
Need Reproduce Script:               http://bugs.php.net/fix.php?id=48499&r=needscript
Try newer version:                   http://bugs.php.net/fix.php?id=48499&r=oldversion
Not developer issue:                 http://bugs.php.net/fix.php?id=48499&r=support
Expected behavior:                   http://bugs.php.net/fix.php?id=48499&r=notwrong
Not enough info:                     http://bugs.php.net/fix.php?id=48499&r=notenoughinfo
Submitted twice:                     http://bugs.php.net/fix.php?id=48499&r=submittedtwice
register_globals:                    http://bugs.php.net/fix.php?id=48499&r=globals
PHP 4 support discontinued:          http://bugs.php.net/fix.php?id=48499&r=php4
Daylight Savings:                    http://bugs.php.net/fix.php?id=48499&r=dst
IIS Stability:                       http://bugs.php.net/fix.php?id=48499&r=isapi
Install GNU Sed:                     http://bugs.php.net/fix.php?id=48499&r=gnused
Floating point limitations:          http://bugs.php.net/fix.php?id=48499&r=float
No Zend Extensions:                  http://bugs.php.net/fix.php?id=48499&r=nozend
MySQL Configuration Error:           http://bugs.php.net/fix.php?id=48499&r=mysqlcfg



Thread (3 messages)

« previous php.doc.bugs (#2355) next »