Edit report at http://bugs.php.net/bug.php?id=49530&edit=1
ID: 49530 Updated by: sjo...@php.net Reported by: sjoerd-php at linuxonly dot nl Summary: SOAP header only results in function call when document/literal -Status: Feedback +Status: Closed Type: Bug Package: SOAP related Operating System: * PHP Version: 5.3.0 Assigned To: dmitry New Comment: Could not reproduce. Previous Comments: ------------------------------------------------------------------------ [2010-05-28 13:43:08] dmi...@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(); ?> ------------------------------------------------------------------------ [2009-09-11 12:20:45] 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. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/bug.php?id=49530&edit=1