|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[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.
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Oct 26 05:00:01 2025 UTC |
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(); ?>