mirror of
https://github.com/php/php-src.git
synced 2024-09-22 18:37:25 +00:00
Fixed bug #50762 (in WSDL mode Soap Header handler function only being called if defined in WSDL). (mephius at gmail dot com)
This commit is contained in:
parent
49d74ebc6e
commit
5f678b58e6
@ -1874,6 +1874,7 @@ PHP_METHOD(SoapServer, handle)
|
||||
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);
|
||||
@ -1881,7 +1882,7 @@ PHP_METHOD(SoapServer, handle)
|
||||
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) &&
|
||||
|
45
ext/soap/tests/bugs/bug50762.phpt
Normal file
45
ext/soap/tests/bugs/bug50762.phpt
Normal file
@ -0,0 +1,45 @@
|
||||
--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
|
36
ext/soap/tests/bugs/bug50762.wsdl
Normal file
36
ext/soap/tests/bugs/bug50762.wsdl
Normal file
@ -0,0 +1,36 @@
|
||||
<?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>
|
Loading…
Reference in New Issue
Block a user