1--TEST-- 2Bug #50762 (in WSDL mode Soap Header handler function only being called if defined in WSDL) 3--SKIPIF-- 4<?php require_once('skipif.inc'); ?> 5--FILE-- 6<?php 7class testSoap { 8 private $auth; 9 public function authToken($token){ 10 $this->auth=true; 11 } 12 public function testHeader($param){ 13 return 'header handler ' . ($this->auth ? 'called' : 'not called'); 14 } 15} 16 17class LocalSoapClient extends SoapClient { 18 19 function __construct($wsdl, $options) { 20 parent::__construct($wsdl, $options); 21 $this->server = new SoapServer($wsdl, $options); 22 $this->server->setObject(new testSoap()); 23 } 24 25 function __doRequest($request, $location, $action, $version, $one_way = 0) { 26 ob_start(); 27 $this->server->handle($request); 28 $response = ob_get_contents(); 29 ob_end_clean(); 30 return $response; 31 } 32 33} 34 35$cl = new LocalSoapClient(dirname(__FILE__).'/bug50762.wsdl', array('cache_wsdl'=>WSDL_CACHE_NONE, 'trace'=>true)); 36 37class authToken{ 38 public function __construct($token){ 39 $this->authToken=$token; 40 } 41} 42 43$cl->__setSoapHeaders(array(new SoapHeader('http://sova.pronto.ru/', 'authToken', new authToken('tokendata')))); 44echo $cl->testHeader('param') . PHP_EOL; 45?> 46--EXPECT-- 47header handler called 48