php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #49530 SOAP header only results in function call when document/literal
Submitted: 2009-09-11 12:20 UTC Modified: 2010-05-29 18:07 UTC
Votes:2
Avg. Score:4.5 ± 0.5
Reproduced:2 of 2 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: sjoerd-php at linuxonly dot nl Assigned: dmitry
Status: Closed Package: SOAP related
PHP Version: 5.3.0 OS: *
Private report: No CVE-ID:
 [2009-09-11 12:20 UTC] sjoerd-php at linuxonly dot nl
Description:
------------
When a SOAP header is sent to a webservice which uses SoapServer, a method with the same name as the header is called. However, this only happens when the webservice is document/literal, not when it is rpc/encoded.

Reproduce code:
---------------
<?php
class SoapHandler
{
	function HeaderAuthenticate($header)
	{
		header("X-Debug: header was called");
	}
	
	function login()
	{ }
}

if ($_GET['doclit']) {
	$wsdl = 'doclit.wsdl'; // http://pastebin.com/f7b1434d9
} else {
	$wsdl = 'rpcencoded.wsdl'; // http://pastebin.com/fe989844
}

$handler = new SoapHandler();
$server = new SoapServer($wsdl);
$server->setObject($handler);
$server->handle();
?>

Expected result:
----------------
With both WSDLs, that the HeaderAuthenticate method is called. That is, the X-Debug header contains "header was called" when the HeaderAuthenticate header was sent.

Actual result:
--------------
The HeaderAuthenticate method is only called with document/literal WSDL.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-05-28 13:43 UTC] dmitry@php.net
-Status: Open +Status: Feedback -Assigned To: +Assigned To: dmitry
 [2010-05-28 13:43 UTC] dmitry@php.net
Both WSDLs work fine for me except for commented <import> line. The client:

<?php
$cl = new SoapClient(dirname(__FILE__).'/bug49530_2.wsdl',
    array('cache_wsdl'=>WSDL_CACHE_NONE, 'trace'=>true));
$cl->__setSoapHeaders(array(new SoapHeader('http://www.myservice.nl/soap/',
    'HeaderAuthenticate',
    array('reactid'=>'test'))));
$ret = $cl->login('user', 'pass');
echo $ret . PHP_EOL;
echo $cl->__getLastRequest();
echo $cl->__getLastResponse();
?>
 [2010-05-29 18:07 UTC] sjoerd@php.net
-Status: Feedback +Status: Closed
 [2010-05-29 18:07 UTC] sjoerd@php.net
Could not reproduce.
 
PHP Copyright © 2001-2014 The PHP Group
All rights reserved.
Last updated: Wed Apr 16 19:02:26 2014 UTC