]> granicus.if.org Git - php/commitdiff
Fixed bug #42086 (SoapServer return Procedure '' not present for WSIBasic compliant...
authorDmitry Stogov <dmitry@php.net>
Fri, 31 Aug 2007 09:36:02 +0000 (09:36 +0000)
committerDmitry Stogov <dmitry@php.net>
Fri, 31 Aug 2007 09:36:02 +0000 (09:36 +0000)
NEWS
ext/soap/soap.c
ext/soap/tests/bugs/bug42086.phpt [new file with mode: 0755]
ext/soap/tests/bugs/bug42086.wsdl [new file with mode: 0755]

diff --git a/NEWS b/NEWS
index 0546cc0f339d7040ad85a700808df372aca80043..063e27ed5cbcb10bf495a4bde7fbe9a2926fda64 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -8,6 +8,8 @@ PHP                                                                        NEWS
 - Fixed bug #42452 (PDO classes do not expose Reflection API information).
   (Hannes)
 - Fixed bug #42326 (SoapServer crash). (Dmitry)
+- Fixed bug #42086 (SoapServer return Procedure '' not present for WSIBasic
+  compliant wsdl). (Dmitry)
 
 30 Aug 2007, PHP 5.2.4
 - Removed --enable-versioning configure option. (Jani)
index 1eb3abe6385e523bbab40c5cb416a75612f8739b..a27626110ef5fae146f3ba06892f4c7b01306012 100644 (file)
@@ -3248,7 +3248,17 @@ static void deserialize_parameters(xmlNodePtr params, sdlFunctionPtr function, i
                        }
                        trav = trav->next;
                }
-               if (num_of_params > 0) {
+
+               if (num_of_params == 1 &&
+                   function &&
+                   function->binding &&
+                   function->binding->bindingType == BINDING_SOAP &&
+                   ((sdlSoapBindingFunctionPtr)function->bindingAttributes)->style == SOAP_DOCUMENT &&
+                   (function->requestParameters == NULL ||
+                    zend_hash_num_elements(function->requestParameters) == 0) &&
+                   strcmp(params->name, function->functionName) == 0) {
+                       num_of_params = 0;
+               } else if (num_of_params > 0) {
                        tmp_parameters = safe_emalloc(num_of_params, sizeof(zval *), 0);
 
                        trav = params;
@@ -3289,7 +3299,11 @@ static sdlFunctionPtr find_function(sdlPtr sdl, xmlNodePtr func, zval* function_
        if (function && function->binding && function->binding->bindingType == BINDING_SOAP) {
                sdlSoapBindingFunctionPtr fnb = (sdlSoapBindingFunctionPtr)function->bindingAttributes;
                if (fnb->style == SOAP_DOCUMENT) {
-                       function = NULL;
+                       if (func->children != NULL ||
+                           (function->requestParameters != NULL &&
+                            zend_hash_num_elements(function->requestParameters) > 0)) {
+                               function = NULL;
+                       }
                }
        }
        if (sdl != NULL && function == NULL) {
diff --git a/ext/soap/tests/bugs/bug42086.phpt b/ext/soap/tests/bugs/bug42086.phpt
new file mode 100755 (executable)
index 0000000..6edc06f
--- /dev/null
@@ -0,0 +1,31 @@
+--TEST--
+Bug #42086 (SoapServer return Procedure '' not present for WSIBasic compliant wsdl)
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--INI--
+soap.wsdl_cache_enabled=0
+--FILE--
+<?php
+$request = <<<EOF
+<?xml version="1.0" encoding="UTF-8"?>
+<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"><SOAP-ENV:Body><firstFunctionWithoutParam/></SOAP-ENV:Body></SOAP-ENV:Envelope>
+EOF;
+
+class firstFunctionWithoutParamResponse {
+       public $param;
+}
+
+function firstFunctionWithoutParam() {
+       $ret = new firstFunctionWithoutParamResponse();
+       $ret->param     =       "firstFunctionWithoutParam";
+       return $ret;
+}
+       
+$server = new SoapServer(dirname(__FILE__).'/bug42086.wsdl',
+       array('features'=>SOAP_SINGLE_ELEMENT_ARRAYS));
+$server->addFunction('firstFunctionWithoutParam');
+$server->handle($request);
+?>
+--EXPECT--
+<?xml version="1.0" encoding="UTF-8"?>
+<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"><SOAP-ENV:Body><firstFunctionWithoutParamReturn><param>firstFunctionWithoutParam</param></firstFunctionWithoutParamReturn></SOAP-ENV:Body></SOAP-ENV:Envelope>
diff --git a/ext/soap/tests/bugs/bug42086.wsdl b/ext/soap/tests/bugs/bug42086.wsdl
new file mode 100755 (executable)
index 0000000..5ec3d95
--- /dev/null
@@ -0,0 +1,141 @@
+<?xml version='1.0' encoding='UTF-8'?>\r
+\r
+<!-- WSDL file generated by Zend Studio. -->\r
+\r
+<definitions name="LBAService" targetNamespace="http://xml.avaya.com/ws/device-management/distributed-enterprise" xmlns:typens="http://xml.avaya.com/ws/device-management/distributed-enterprise" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns="http://schemas.xmlsoap.org/wsdl/">\r
+       <types>\r
+               <xsd:schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="http://xml.avaya.com/ws/device-management/distributed-enterprise">\r
+                       <xsd:complexType name="firstFunctionClassParam">\r
+                               <xsd:all>\r
+                                       <xsd:element name="param" type="xsd:string"/>\r
+                                       <xsd:element name="vectparam" type="xsd:string" minOccurs="0" maxOccurs="unbounded"/>\r
+                               </xsd:all>\r
+                       </xsd:complexType>\r
+                       <xsd:complexType name="firstFunctionClassParamResponse">\r
+                               <xsd:all>\r
+                                       <xsd:element name="param" type="xsd:string"/>\r
+                               </xsd:all>\r
+                       </xsd:complexType>\r
+                       <xsd:complexType name="firstFunctionWithoutParamResponse">\r
+                               <xsd:all>\r
+                                       <xsd:element name="param" type="xsd:string"/>\r
+                               </xsd:all>\r
+                       </xsd:complexType>\r
+                       <xsd:complexType name="secondFunctionClassParam">\r
+                               <xsd:all>\r
+                                       <xsd:element name="param" type="xsd:string"/>\r
+                                       <xsd:element name="vectparam" type="xsd:string" minOccurs="0" maxOccurs="unbounded"/>\r
+                               </xsd:all>\r
+                       </xsd:complexType>\r
+                       <xsd:complexType name="secondFunctionClassParamResponse">\r
+                               <xsd:all>\r
+                                       <xsd:element name="param" type="xsd:string"/>\r
+                               </xsd:all>\r
+                       </xsd:complexType>\r
+                       <xsd:complexType name="secondFunctionWithoutParamResponse">\r
+                               <xsd:all>\r
+                                       <xsd:element name="param" type="xsd:string"/>\r
+                               </xsd:all>\r
+                       </xsd:complexType>\r
+               </xsd:schema>\r
+       </types>\r
+       <message name="firstFunctionClassParam">\r
+               <part name="firstFunctionClassParam" type="typens:firstFunctionClassParam"/>\r
+       </message>\r
+       <message name="firstFunctionClassParamResponse">\r
+               <part name="firstFunctionClassParamReturn" type="typens:firstFunctionClassParamResponse"/>\r
+       </message>\r
+       <message name="firstFunctionWithoutParam"/>\r
+<!--\r
+       <message name="firstFunctionWithoutParam">\r
+               <part name="firstFunctionWithoutParam"/>\r
+       </message>\r
+-->\r
+       <message name="firstFunctionWithoutParamResponse">\r
+               <part name="firstFunctionWithoutParamReturn" type="typens:firstFunctionWithoutParamResponse"/>\r
+       </message>\r
+       <message name="secondFunctionClassParam">\r
+               <part name="secondFunctionClassParam" type="typens:secondFunctionClassParam"/>\r
+       </message>\r
+       <message name="secondFunctionClassParamResponse">\r
+               <part name="secondFunctionClassParamReturn" type="typens:secondFunctionClassParamResponse"/>\r
+       </message>\r
+       <message name="secondFunctionWithoutParam"/>\r
+       <message name="secondFunctionWithoutParamResponse">\r
+               <part name="secondFunctionWithoutParamReturn" type="typens:secondFunctionWithoutParamResponse"/>\r
+       </message>\r
+       <portType name="wsImpPortType">\r
+               <operation name="firstFunctionClassParam">\r
+                       <documentation>\r
+                               Enter description here...\r
+                       </documentation>\r
+                       <input message="typens:firstFunctionClassParam"/>\r
+                       <output message="typens:firstFunctionClassParamResponse"/>\r
+               </operation>\r
+               <operation name="firstFunctionWithoutParam">\r
+                       <documentation>\r
+                               Enter description here...\r
+                       </documentation>\r
+                       <input message="typens:firstFunctionWithoutParam"/>\r
+                       <output message="typens:firstFunctionWithoutParamResponse"/>\r
+               </operation>\r
+               <operation name="secondFunctionClassParam">\r
+                       <documentation>\r
+                               Enter description here...\r
+                       </documentation>\r
+                       <input message="typens:secondFunctionClassParam"/>\r
+                       <output message="typens:secondFunctionClassParamResponse"/>\r
+               </operation>\r
+               <operation name="secondFunctionWithoutParam">\r
+                       <documentation>\r
+                               Enter description here...\r
+                       </documentation>\r
+                       <input message="typens:secondFunctionWithoutParam"/>\r
+                       <output message="typens:secondFunctionWithoutParamResponse"/>\r
+               </operation>\r
+       </portType>\r
+       <binding name="wsImpBinding" type="typens:wsImpPortType">\r
+               <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>\r
+               <operation name="firstFunctionClassParam">\r
+                       <soap:operation soapAction="urn:wsImpAction"/>\r
+                       <input>\r
+                               <soap:body namespace="http://xml.avaya.com/ws/device-management/distributed-enterprise" use="literal"/>\r
+                       </input>\r
+                       <output>\r
+                               <soap:body namespace="http://xml.avaya.com/ws/device-management/distributed-enterprise" use="literal"/>\r
+                       </output>\r
+               </operation>\r
+               <operation name="firstFunctionWithoutParam">\r
+                       <soap:operation soapAction="urn:wsImpAction"/>\r
+                       <input>\r
+                               <soap:body namespace="http://xml.avaya.com/ws/device-management/distributed-enterprise" use="literal"/>\r
+                       </input>\r
+                       <output>\r
+                               <soap:body namespace="http://xml.avaya.com/ws/device-management/distributed-enterprise" use="literal"/>\r
+                       </output>\r
+               </operation>\r
+               <operation name="secondFunctionClassParam">\r
+                       <soap:operation soapAction="urn:wsImpAction"/>\r
+                       <input>\r
+                               <soap:body namespace="http://xml.avaya.com/ws/device-management/distributed-enterprise" use="literal"/>\r
+                       </input>\r
+                       <output>\r
+                               <soap:body namespace="http://xml.avaya.com/ws/device-management/distributed-enterprise" use="literal"/>\r
+                       </output>\r
+               </operation>\r
+               <operation name="secondFunctionWithoutParam">\r
+                       <soap:operation soapAction="urn:wsImpAction"/>\r
+                       <input>\r
+                               <soap:body namespace="http://xml.avaya.com/ws/device-management/distributed-enterprise" use="literal"/>\r
+                       </input>\r
+                       <output>\r
+                               <soap:body namespace="http://xml.avaya.com/ws/device-management/distributed-enterprise" use="literal"/>\r
+                       </output>\r
+               </operation>\r
+       </binding>\r
+       <service name="LBAService">\r
+               <port name="wsImpPort" binding="typens:wsImpBinding">\r
+                       <soap:address location="test://"/>\r
+               </port>\r
+       </service>\r
+</definitions>\r