Skip to content

Commit 7e816c0

Browse files
author
Dmitry Stogov
committed
Fixed bug #50997 (SOAP Error when trying to submit 2nd Element of a choice)
1 parent 67d7d03 commit 7e816c0

File tree

2 files changed

+70
-0
lines changed

2 files changed

+70
-0
lines changed

ext/soap/tests/bugs/bug50997.phpt

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
--TEST--
2+
Bug #50997 (SOAP Error when trying to submit 2nd Element of a choice)
3+
--SKIPIF--
4+
<?php require_once('skipif.inc'); ?>
5+
--INI--
6+
soap.wsdl_cache_enabled=0
7+
--FILE--
8+
<?php
9+
$soapClient = new SoapClient(__DIR__ . '/bug50997.wsdl', array('trace' => 1, 'exceptions'=>0));
10+
$params = array('code'=>'foo');
11+
$soapClient->newOperation($params);
12+
echo $soapClient->__getLastRequest();
13+
?>
14+
--EXPECT--
15+
<?xml version="1.0" encoding="UTF-8"?>
16+
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://www.example.org/service2/"><SOAP-ENV:Body><ns1:NewOperation><code>foo</code></ns1:NewOperation></SOAP-ENV:Body></SOAP-ENV:Envelope>

ext/soap/tests/bugs/bug50997.wsdl

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://www.example.org/service2/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="service2" targetNamespace="http://www.example.org/service2/">
3+
<wsdl:types>
4+
<xsd:schema targetNamespace="http://www.example.org/service2/">
5+
<xsd:element name="NewOperation">
6+
<xsd:complexType>
7+
<xsd:choice>
8+
<xsd:sequence>
9+
<xsd:element name="firstName" type="xsd:string"> </xsd:element>
10+
<xsd:element name="surName" type="xsd:string"/>
11+
</xsd:sequence>
12+
<xsd:element name="code" type="xsd:string"/>
13+
</xsd:choice>
14+
</xsd:complexType>
15+
</xsd:element>
16+
<xsd:element name="NewOperationResponse">
17+
<xsd:complexType>
18+
<xsd:sequence>
19+
<xsd:element name="out" type="xsd:string"/>
20+
</xsd:sequence>
21+
</xsd:complexType>
22+
</xsd:element>
23+
</xsd:schema>
24+
</wsdl:types>
25+
<wsdl:message name="NewOperationRequest">
26+
<wsdl:part element="tns:NewOperation" name="parameters"/>
27+
</wsdl:message>
28+
<wsdl:message name="NewOperationResponse">
29+
<wsdl:part element="tns:NewOperationResponse" name="parameters"/>
30+
</wsdl:message>
31+
<wsdl:portType name="service2">
32+
<wsdl:operation name="NewOperation">
33+
<wsdl:input message="tns:NewOperationRequest"/>
34+
<wsdl:output message="tns:NewOperationResponse"/>
35+
</wsdl:operation>
36+
</wsdl:portType>
37+
<wsdl:binding name="service2SOAP" type="tns:service2">
38+
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
39+
<wsdl:operation name="NewOperation">
40+
<soap:operation soapAction="http://www.example.org/service2/NewOperation"/>
41+
<wsdl:input>
42+
<soap:body use="literal"/>
43+
</wsdl:input>
44+
<wsdl:output>
45+
<soap:body use="literal"/>
46+
</wsdl:output>
47+
</wsdl:operation>
48+
</wsdl:binding>
49+
<wsdl:service name="service2">
50+
<wsdl:port binding="tns:service2SOAP" name="service2SOAP">
51+
<soap:address location="test://"/>
52+
</wsdl:port>
53+
</wsdl:service>
54+
</wsdl:definitions>

0 commit comments

Comments
 (0)