Bug #49853 [Com]: Soap Client stream context header option ignored

From: Date: Mon, 09 May 2011 15:09:05 +0000
Subject: Bug #49853 [Com]: Soap Client stream context header option ignored
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-160619@lists.php.net to get a copy of this message
Edit report at http://bugs.php.net/bug.php?id=49853&edit=1

 ID:                 49853
 Comment by:         vidalis dot aris at gmail dot com
 Reported by:        rumana024 at yahoo dot com
 Summary:            Soap Client stream context header option ignored
 Status:             Open
 Type:               Bug
 Package:            SOAP related
 Operating System:   Windows XP
 PHP Version:        5.2SVN-2009-10-12 (SVN)
 Block user comment: N
 Private report:     N

 New Comment:

Using php5.3.6 i couldn't pass extra HTTP headers to the SOAP request.
stream_context_create appears to get ignored

[VERSION]
PHP 5.3.6 with Suhosin-Patch (cli) (built: Apr 18 2011 11:14:25)
Copyright (c) 1997-2011 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2011 Zend Technologies

[CODE]
$context = stream_context_create(array('http' => array('header' =>
"token: 
85E91AAC-7A4A-11E0-B46B-78E7D1E19752\r\n")));

        $soapparams = array(                    
                                                'stream_context' =>
$context,
                                                'trace' => 1,
                                                'exceptions' => 1,
                                                'soap_version' =>
SOAP_1_2,
                                                'encoding' => 'UTF-8',
                                                'features' => 
SOAP_SINGLE_ELEMENT_ARRAYS
                                );
$client = new SoapClient($wsdl,$soapparams);

[REQUEST HEADERS]
POST /SocialMetadataService HTTP/1.1
Host: test.host.com:9080
Connection: Keep-Alive
User-Agent: PHP-SOAP/5.3.6
Content-Type: application/soap+xml; charset=utf-8;
action="urn:getObjectID"
Content-Length: 331


Previous Comments:
------------------------------------------------------------------------
[2009-10-15 18:48:44] rumana024 at yahoo dot com

I have solved my issue... Yahoooooooooo...
I switched to php5.3. And I now the http headers are passing through.

------------------------------------------------------------------------
[2009-10-14 23:31:01] rumana024 at yahoo dot com

I see a conversation at
http://aspn.activestate.com/ASPN/Mail/Message/php-dev/3710449
about
Transfer-Encoding: chunked and its affect on stream_context parameters.
Is this the problem?

------------------------------------------------------------------------
[2009-10-14 19:37:32] rumana024 at yahoo dot com

Is this a PHP bug? If not,can you please post some sample !working! code
on creating a SOAP Client with the stream_context option and http
header(in this case https). Those headers can be seen as the part of the
http request headers. I have pretty much tried different suggestions
that I read on diffrent threads on www and php.net to make a successful
soap call.    

Regards
RI

------------------------------------------------------------------------
[2009-10-13 18:03:07] rumana024 at yahoo dot com

$headers = array('X-USERID: user_1253314668.com\r\n', 
                'Content-type: application/x-www-form-urlencoded\r\n',
                'X-PASSWORD: 1253314679\r\n',
                'X-SIGNATURE:
AtQaNHC.hbpghF5uGCRO99PVYV7ki3.SAb3vQzBlBAxEyi0b\r\n',
                'X-VERSION: 1.2.0\r\n',
	        'X-PROTOCOL: SOAP11\r\n',
                'X-SOURCE: PHP_SOAP_SAMPLE_V1\r\n');	

$context = stream_context_create(array('http' => array('header' =>
$headers)));

$soapClient = new SoapClient(null,array('location' =>
"https://svcs.sandbox.com/Method1/", 
                                        'uri' =>
"http://x.x.com/types/test", 
                                        'soap_version' =>
SOAP_1_1,'trace' => 1, 'stream_context' => $context)); 



//Constructing the Payload
$param = "the payload"
$result = $soapClient->Method1($params);


I have changed the wrapper from https to http. Also made the header an
array. Still the same error. I do not see the http header with other
http headers when print the $soapClient->_getLastRequestHeaders().
Please advice how to resolve the issue.

------------------------------------------------------------------------
[2009-10-13 10:48:05] sjoerd@php.net

Thank you for your bug report.

Please try 'http' as wrapper name instead of 'https'.

------------------------------------------------------------------------


The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at

    http://bugs.php.net/bug.php?id=49853


-- 
Edit this bug report at http://bugs.php.net/bug.php?id=49853&edit=1


Thread (14 messages)

« previous php.bugs (#160619) next »