Browse Source

Fixed SOAP binding selection

PHP-5.2.1RC1
Dmitry Stogov 18 years ago
parent
commit
c55fc5cfa4
  1. 4
      ext/soap/php_sdl.c
  2. 6
      ext/soap/tests/bugs/bug29109.phpt
  3. 16
      ext/soap/tests/bugs/multiport.phpt
  4. 88
      ext/soap/tests/bugs/multiport.wsdl

4
ext/soap/php_sdl.c

@ -721,12 +721,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>");
}
}

6
ext/soap/tests/bugs/bug29109.phpt

@ -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()"
}

16
ext/soap/tests/bugs/multiport.phpt

@ -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>

88
ext/soap/tests/bugs/multiport.wsdl

@ -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>
Loading…
Cancel
Save