]> granicus.if.org Git - php/commitdiff
Fixed bug #41337 (WSDL parsing doesn't ignore non soap bindings)
authorDmitry Stogov <dmitry@php.net>
Thu, 10 May 2007 14:58:32 +0000 (14:58 +0000)
committerDmitry Stogov <dmitry@php.net>
Thu, 10 May 2007 14:58:32 +0000 (14:58 +0000)
ext/soap/php_sdl.c
ext/soap/tests/bugs/bug41337.phpt [new file with mode: 0755]
ext/soap/tests/bugs/bug41337.wsdl [new file with mode: 0755]

index 62fbf1f105783eda4b5e4a51b9ad53f1ec076060..6d076344da705c7a369cde9101aaaa182ae32290 100644 (file)
@@ -654,6 +654,7 @@ static sdlPtr load_wsdl(char *struri TSRMLS_DC)
                for (i = 0; i < n; i++) {
                        xmlNodePtr *tmp, service;
                        xmlNodePtr trav, port;
+                       int has_soap_port = 0;
 
                        zend_hash_get_current_data(&ctx.services, (void **)&tmp);
                        service = *tmp;
@@ -716,8 +717,15 @@ static sdlPtr load_wsdl(char *struri TSRMLS_DC)
                                  trav2 = trav2->next;
                                }
                                if (!address) {
-                                       soap_error0(E_ERROR, "Parsing WSDL: No address associated with <port>");
+                                       if (has_soap_port || trav->next) {
+                                               efree(tmpbinding);
+                                               trav = trav->next;
+                                               continue;
+                                       } else {
+                                               soap_error0(E_ERROR, "Parsing WSDL: No address associated with <port>");
+                                       }
                                }
+                               has_soap_port = 1;
 
                                location = get_attribute(address->properties, "location");
                                if (!location) {
diff --git a/ext/soap/tests/bugs/bug41337.phpt b/ext/soap/tests/bugs/bug41337.phpt
new file mode 100755 (executable)
index 0000000..cd777d1
--- /dev/null
@@ -0,0 +1,12 @@
+--TEST--
+Bug #41337 (WSDL parsing doesn't ignore non soap bindings)
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+ini_set("soap.wsdl_cache_enabled",0);
+$client = new SoapClient(dirname(__FILE__)."/bug41337.wsdl");
+echo "ok\n";
+?>
+--EXPECT--
+ok
diff --git a/ext/soap/tests/bugs/bug41337.wsdl b/ext/soap/tests/bugs/bug41337.wsdl
new file mode 100755 (executable)
index 0000000..14e5dc4
--- /dev/null
@@ -0,0 +1,63 @@
+<?xml version="1.0" ?>
+<definitions
+    xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
+    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
+    xmlns:si="http://soapinterop.org/xsd"
+    xmlns:tns="http://linuxsrv.home/~dmitry/soap/test.wsdl"
+    xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
+    xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+    xmlns="http://schemas.xmlsoap.org/wsdl/"
+    targetNamespace="http://linuxsrv.home/~dmitry/soap/test.wsdl">
+
+  <types>
+    <xsd:schema targetNamespace="http://linuxsrv.home/~dmitry/soap/test.wsdl">
+      <xsd:import namespace="http://schemas.xmlsoap.org/soap/encoding/" />
+      <xsd:import namespace="http://schemas.xmlsoap.org/wsdl/" />
+    </xsd:schema>
+  </types>
+
+  <message name="AddRequest">
+    <part name="x" type="xsd:double" />
+    <part name="y" type="xsd:double" />
+  </message>
+  <message name="AddResponse">
+    <part name="result" type="xsd:double" />
+  </message>
+
+  <portType name="TestServicePortType">
+    <operation name="Add">
+      <input message="tns:AddRequest" />
+      <output message="tns:AddResponse" />
+    </operation>
+  </portType>
+
+  <binding name="TestServiceBinding2" type="tns:TestServicePortType">
+    <operation name="Add">
+      <input/>
+      <output/>
+    </operation>
+  </binding>
+
+  <binding name="TestServiceBinding" type="tns:TestServicePortType">
+    <soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http" />
+    <operation name="Add">
+      <soap:operation soapAction="Add" style="rpc" />
+      <input>
+        <soap:body use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
+      </input>
+      <output>
+        <soap:body use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
+      </output>
+    </operation>
+  </binding>
+
+  <service name="TestService">
+    <port name="TestServicePort2" binding="tns:TestServiceBinding"/>
+    <port name="TestServicePort" binding="tns:TestServiceBinding">
+      <soap:address location="http://linuxsrv.home/~dmitry/soap/soap_server.php" />
+    </port>
+  </service>
+
+</definitions>