php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #46096 SoapClient constructor:'stream_context' key of 'options' parameter is not used
Submitted: 2008-09-16 16:19 UTC Modified: 2009-02-21 01:00 UTC
Votes:38
Avg. Score:4.6 ± 0.7
Reproduced:33 of 34 (97.1%)
Same Version:20 (60.6%)
Same OS:8 (24.2%)
From: alberto at edistar dot com Assigned:
Status: No Feedback Package: SOAP related
PHP Version: 5.2.6 OS: linux Ubuntu (kernel: 2.6.17)
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: alberto at edistar dot com
New email:
PHP Version: OS:

 

 [2008-09-16 16:19 UTC] alberto at edistar dot com
Description:
------------
I need to add an http header to a Soap request using SoapClient class.
The way I found in documentation is using 'stream_context' of '$options' constructor's parameter. But the class doesn't consider that option, either in "wsdl" mode and "non wsdl" mode. So the target web service doesn't receive the added  http header.

Reproduce code:
---------------
$additionalHeader = array( 'http'=>array('header' => "Token: 123"));
$context = stream_context_create($additionalHeader);
$clientSoap = new SOAPClient('http://yoururl/yourwsdl.wsdl',
array('trace' => 1, 'stream_context' => $context, 'exceptions' => false));
$clientSoap->yourMethod($yourParameter);

Expected result:
----------------
Target web service receives an http header named 'Token' with value "123"

Actual result:
--------------
Target web service doesn't receive an http header named 'Token' with value "123"

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-02-13 23:29 UTC] felipe@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php5.2-latest.tar.gz
 
For Windows:

  http://windows.php.net/snapshots/


 [2009-02-21 01:00 UTC] php-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".
 [2009-04-17 17:06 UTC] jchernia1 at yahoo dot com
This looks like a dupe of 46427
 [2009-06-11 15:41 UTC] ctbh at mailinator dot com
Good thinking, but after applying the workaround I find in the problem description of bug #46427, this still does not work.

Looks like the stream_context option is just ignored, I can't make any of the stream_context options (header, user_agent, etc) have an effect on how SoapClient makes HTTP requests.

Definitely still an issue. :(
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 12:01:31 2024 UTC