summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorDmitry Stogov <dmitry@php.net>2010-05-28 10:52:16 (GMT)
committerDmitry Stogov <dmitry@php.net>2010-05-28 10:52:16 (GMT)
commit5f678b58e6956d79a59570bfd8312a8ed5ea6443 (patch)
tree377479dce68ad52942f5d96743e4065067d7c092 /ext
parent49d74ebc6e75a6c8e175f72ab02db087710b6375 (diff)
downloadphp-5f678b58e6956d79a59570bfd8312a8ed5ea6443.tar.gz
Fixed bug #50762 (in WSDL mode Soap Header handler function only being called if defined in WSDL). (mephius at gmail dot com)
Diffstat (limited to 'ext')
-rw-r--r--ext/soap/soap.c3
-rw-r--r--ext/soap/tests/bugs/bug50762.phpt45
-rw-r--r--ext/soap/tests/bugs/bug50762.wsdl36
3 files changed, 83 insertions, 1 deletions
diff --git a/ext/soap/soap.c b/ext/soap/soap.c
index 9344073..02e7550 100644
--- a/ext/soap/soap.c
+++ b/ext/soap/soap.c
@@ -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) &&
diff --git a/ext/soap/tests/bugs/bug50762.phpt b/ext/soap/tests/bugs/bug50762.phpt
new file mode 100644
index 0000000..f9099f1
--- /dev/null
+++ b/ext/soap/tests/bugs/bug50762.phpt
@@ -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
diff --git a/ext/soap/tests/bugs/bug50762.wsdl b/ext/soap/tests/bugs/bug50762.wsdl
new file mode 100644
index 0000000..2980589
--- /dev/null
+++ b/ext/soap/tests/bugs/bug50762.wsdl
@@ -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>