]> granicus.if.org Git - php/commitdiff
Fixed SOAP binding selection
authorDmitry Stogov <dmitry@php.net>
Wed, 18 Jun 2008 07:23:58 +0000 (07:23 +0000)
committerDmitry Stogov <dmitry@php.net>
Wed, 18 Jun 2008 07:23:58 +0000 (07:23 +0000)
ext/soap/php_sdl.c
ext/soap/tests/bugs/bug29109.phpt
ext/soap/tests/bugs/multiport.phpt [new file with mode: 0644]
ext/soap/tests/bugs/multiport.wsdl [new file with mode: 0644]

index 07c3b5d657287afda26578fae63625ff168c7dee..fcc90aa742ac9ff576281e8b2eed5947fe88d68f 100644 (file)
@@ -722,12 +722,12 @@ static sdlPtr load_wsdl(zval *this_ptr, char *struri TSRMLS_DC)
                                        }
                                  trav2 = trav2->next;
                                }
-                               if (!address) {
+                               if (!address || tmpbinding->bindingType == BINDING_HTTP) {
                                        if (has_soap_port || trav->next || i < n-1) {
                                                efree(tmpbinding);
                                                trav = trav->next;
                                                continue;
-                                       } else {
+                                       } else if (!address) {
                                                soap_error0(E_ERROR, "Parsing WSDL: No address associated with <port>");
                                        }
                                }
index 8f028d71b7691f02e7fffdd0a50cff06897ddb6e..3b13974d073dbae55454c214cae82b8ae64012ba 100644 (file)
@@ -10,11 +10,7 @@ $client = new SoapClient(dirname(__FILE__)."/bug29109.wsdl");
 var_dump($client->__getFunctions()); 
 ?>
 --EXPECT--
-array(3) {
+array(1) {
   [0]=>
   string(53) "HelloWorldResponse HelloWorld(HelloWorld $parameters)"
-  [1]=>
-  string(19) "string HelloWorld()"
-  [2]=>
-  string(19) "string HelloWorld()"
 }
\ No newline at end of file
diff --git a/ext/soap/tests/bugs/multiport.phpt b/ext/soap/tests/bugs/multiport.phpt
new file mode 100644 (file)
index 0000000..0b5e944
--- /dev/null
@@ -0,0 +1,16 @@
+--TEST--
+Proper binding selection
+--SKIPIF--
+<?php require_once 'skipif.inc'; ?>
+--INI--
+soap.wsdl_cache_enabled=0
+--FILE--
+<?php
+$client = new SoapClient(dirname(__FILE__).'/multiport.wsdl', 
+       array('trace' => true, 'exceptions' => false));
+$response = $client->GetSessionId(array('userId'=>'user', 'password'=>'password'));
+echo $client->__getLastRequest();
+?>
+--EXPECT--
+<?xml version="1.0" encoding="UTF-8"?>
+<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://www.reuters.com/"><SOAP-ENV:Body><ns1:GetSessionId><ns1:userId>user</ns1:userId><ns1:password>password</ns1:password></ns1:GetSessionId></SOAP-ENV:Body></SOAP-ENV:Envelope>
diff --git a/ext/soap/tests/bugs/multiport.wsdl b/ext/soap/tests/bugs/multiport.wsdl
new file mode 100644 (file)
index 0000000..604e963
--- /dev/null
@@ -0,0 +1,88 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<wsdl:definitions targetNamespace="http://www.reuters.com/" xmlns:tns="http://www.reuters.com/" xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:s="http://www.w3.org/2001/XMLSchema">
+  <wsdl:types>
+    <s:schema elementFormDefault="qualified" targetNamespace="http://www.reuters.com/">
+      <s:element name="GetSessionId">
+        <s:complexType>
+          <s:sequence>
+            <s:element maxOccurs="1" minOccurs="0" name="userId" type="s:string"/>
+            <s:element maxOccurs="1" minOccurs="0" name="password" type="s:string"/>
+          </s:sequence>
+        </s:complexType>
+      </s:element>
+      <s:element name="GetSessionIdResponse">
+        <s:complexType>
+          <s:sequence>
+            <s:element maxOccurs="1" minOccurs="0" name="GetSessionIdResult" type="s:string"/>
+          </s:sequence>
+        </s:complexType>
+      </s:element>
+    </s:schema>
+  </wsdl:types>
+  <wsdl:message name="GetSessionIdHttpGetIn">
+    <wsdl:part name="userId" type="s:string">
+    </wsdl:part>
+    <wsdl:part name="password" type="s:string">
+    </wsdl:part>
+  </wsdl:message>
+  <wsdl:message name="GetSessionIdHttpGetOut">
+    <wsdl:part name="Body" element="tns:string">
+    </wsdl:part>
+  </wsdl:message>
+  <wsdl:message name="GetSessionIdSoapOut">
+    <wsdl:part name="parameters" element="tns:GetSessionIdResponse">
+    </wsdl:part>
+  </wsdl:message>
+  <wsdl:message name="GetSessionIdSoapIn">
+    <wsdl:part name="parameters" element="tns:GetSessionId">
+    </wsdl:part>
+  </wsdl:message>
+  <wsdl:portType name="StocksDataSecureHttpGet">
+    <wsdl:operation name="GetSessionId">
+      <wsdl:input message="tns:GetSessionIdHttpGetIn">
+    </wsdl:input>
+      <wsdl:output message="tns:GetSessionIdHttpGetOut">
+    </wsdl:output>
+    </wsdl:operation>
+  </wsdl:portType>
+  <wsdl:portType name="StocksDataSecureSoap">
+    <wsdl:operation name="GetSessionId">
+      <wsdl:input message="tns:GetSessionIdSoapIn">
+    </wsdl:input>
+      <wsdl:output message="tns:GetSessionIdSoapOut">
+    </wsdl:output>
+    </wsdl:operation>
+  </wsdl:portType>
+  <wsdl:binding name="StocksDataSecureHttpGet" type="tns:StocksDataSecureHttpGet">
+    <http:binding verb="GET"/>
+    <wsdl:operation name="GetSessionId">
+      <http:operation location="/GetSessionId"/>
+      <wsdl:input>
+        <http:urlEncoded/>
+      </wsdl:input>
+      <wsdl:output>
+        <mime:mimeXml part="Body"/>
+      </wsdl:output>
+    </wsdl:operation>
+  </wsdl:binding>
+  <wsdl:binding name="StocksDataSecureSoap" type="tns:StocksDataSecureSoap">
+    <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
+    <wsdl:operation name="GetSessionId">
+      <soap:operation soapAction="http://www.reuters.com/GetSessionId" style="document"/>
+      <wsdl:input>
+        <soap:body use="literal"/>
+      </wsdl:input>
+      <wsdl:output>
+        <soap:body use="literal"/>
+      </wsdl:output>
+    </wsdl:operation>
+  </wsdl:binding>
+  <wsdl:service name="StocksDataSecure">
+    <wsdl:port name="StocksDataSecureHttpGet" binding="tns:StocksDataSecureHttpGet">
+      <http:address location="test://"/>
+    </wsdl:port>
+    <wsdl:port name="StocksDataSecureSoap" binding="tns:StocksDataSecureSoap">
+      <soap:address location="test://"/>
+    </wsdl:port>
+  </wsdl:service>
+</wsdl:definitions>