soapHeader *h = header;
header = header->next;
+#if 0
if (service->sdl && !h->function && !h->hdr) {
if (h->mustUnderstand) {
soap_server_fault("MustUnderstand","Header not understood", NULL, NULL, NULL TSRMLS_CC);
continue;
}
}
-
+#endif
fn_name = estrndup(Z_STRVAL(h->function_name),Z_STRLEN(h->function_name));
if (zend_hash_exists(function_table, php_strtolower(fn_name, Z_STRLEN(h->function_name)), Z_STRLEN(h->function_name) + 1) ||
((service->type == SOAP_CLASS || service->type == SOAP_OBJECT) &&
--- /dev/null
+--TEST--
+Bug #50762 (in WSDL mode Soap Header handler function only being called if defined in WSDL)
+--FILE--
+<?php
+class testSoap {
+ private $auth;
+ public function authToken($token){
+ $this->auth=true;
+ }
+ public function testHeader($param){
+ return 'header handler ' . ($this->auth ? 'called' : 'not called');
+ }
+}
+
+class LocalSoapClient extends SoapClient {
+
+ function __construct($wsdl, $options) {
+ parent::__construct($wsdl, $options);
+ $this->server = new SoapServer($wsdl, $options);
+ $this->server->setObject(new testSoap());
+ }
+
+ function __doRequest($request, $location, $action, $version, $one_way = 0) {
+ ob_start();
+ $this->server->handle($request);
+ $response = ob_get_contents();
+ ob_end_clean();
+ return $response;
+ }
+
+}
+
+$cl = new LocalSoapClient(dirname(__FILE__).'/bug50762.wsdl', array('cache_wsdl'=>WSDL_CACHE_NONE, 'trace'=>true));
+
+class authToken{
+ public function __construct($token){
+ $this->authToken=$token;
+ }
+}
+
+$cl->__setSoapHeaders(array(new SoapHeader('http://sova.pronto.ru/', 'authToken', new authToken('tokendata'))));
+echo $cl->testHeader('param') . PHP_EOL;
+?>
+--EXPECT--
+header handler called
--- /dev/null
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://sova.pronto.ru/" xmlns:xsd1="http://sova.pronto.ru/schema" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="sova" targetNamespace="http://sova.pronto.ru/">
+ <wsdl:message name="authToken">
+ <wsdl:part name="authToken" type="xsd:string"/>
+ </wsdl:message>
+ <wsdl:message name="message">
+ <wsdl:part name="param" type="xsd:string"/>
+ </wsdl:message>
+
+ <wsdl:portType name="sova">
+ <wsdl:operation name="testHeader">
+ <wsdl:input message="tns:message"/>
+ <wsdl:output message="tns:message"/>
+ </wsdl:operation>
+ </wsdl:portType>
+ <wsdl:binding name="sovaSOAP" type="tns:sova">
+ <soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
+
+ <wsdl:operation name="testHeader">
+ <soap:operation soapAction="http://sova.pronto.ru/testHeader"/>
+ <wsdl:input>
+ <soap:body namespace="http://sova.pronto.ru/" use="literal"/>
+ <soap:header use="literal" part="authToken" message="tns:authToken" wsdl:required="true"/>
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body namespace="http://sova.pronto.ru/" use="literal"/>
+ </wsdl:output>
+ </wsdl:operation>
+
+ </wsdl:binding>
+ <wsdl:service name="sova">
+ <wsdl:port binding="tns:sovaSOAP" name="sovaSOAP">
+ <soap:address location="http://sova.mephius.prontosoft.by/sova/soaptest.php"/>
+ </wsdl:port>
+ </wsdl:service>
+</wsdl:definitions>