|  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
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 (profile)
Status: Closed Package: SOAP related
PHP Version: 5.3.0 OS: *
Private report: No CVE-ID: None
 [2009-09-11 12:20 UTC] sjoerd-php at linuxonly dot nl
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:
class SoapHandler
	function HeaderAuthenticate($header)
		header("X-Debug: header was called");
	function login()
	{ }

if ($_GET['doclit']) {
	$wsdl = 'doclit.wsdl'; //
} else {
	$wsdl = 'rpcencoded.wsdl'; //

$handler = new SoapHandler();
$server = new SoapServer($wsdl);

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.


Add a Patch

Pull Requests

Add a Pull Request


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

$cl = new SoapClient(dirname(__FILE__).'/bug49530_2.wsdl',
    array('cache_wsdl'=>WSDL_CACHE_NONE, 'trace'=>true));
$cl->__setSoapHeaders(array(new SoapHeader('',
$ret = $cl->login('user', 'pass');
echo $ret . PHP_EOL;
echo $cl->__getLastRequest();
echo $cl->__getLastResponse();
 [2010-05-29 18:07 UTC]
-Status: Feedback +Status: Closed
 [2010-05-29 18:07 UTC]
Could not reproduce.
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Jul 20 16:01:29 2024 UTC