php bug-soap-array

raw

bug-soap-array.php

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
<?php
ini_set('default_socket_timeout', 0.01);
$sc = new SoapClient(
    __DIR__ . '/bug-soap-array.wsdl.xml',
    array('trace' => 1)
);
try {
    $sc->doSomething(
        array(
            'correctStrings' => array(
                0 => 'foo',
                1 => 'foo2',
            ),
            'brokenStrings' => array(
                0 => 'bar',
                2 => 'bar2',
            )
        )
    );
} catch (Exception $e) {
    //var_dump($e->getMessage());
}
echo $sc->__getLastRequest() . "\n";
 
?>
 
raw

bug-soap-array.wsdl.xml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions
    xmlns:tns="http://example.org/bug-soap-array"
    xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/"
    targetNamespace="http://example.org/bug-soap-array"
>
  <wsdl:types>
    <xsd:schema targetNamespace="http://example.org/bug-soap-array">
 
      <xsd:complexType name="ArrayOfString">
        <xsd:sequence>
          <xsd:element maxOccurs="unbounded" minOccurs="0" name="string" nillable="true" type="xsd:string"/>
        </xsd:sequence>
      </xsd:complexType>
 
      <xsd:element name="request">
        <xsd:complexType>
          <xsd:sequence>
            <xsd:element maxOccurs="1" minOccurs="1" name="correctStrings" type="tns:ArrayOfString"/>
            <xsd:element maxOccurs="1" minOccurs="1" name="brokenStrings" type="tns:ArrayOfString"/>
          </xsd:sequence>
        </xsd:complexType>
      </xsd:element>
 
      <xsd:element name="response">
      </xsd:element>
    </xsd:schema>
  </wsdl:types>
 
  <wsdl:message name="request">
    <wsdl:part name="parameters" element="tns:request"/>
  </wsdl:message>
  <wsdl:message name="response">
    <wsdl:part name="parameters" element="tns:response"/>
  </wsdl:message>
 
  <wsdl:portType name="testType">
    <wsdl:operation name="doSomething">
      <wsdl:input name="request" message="tns:request"/>
      <wsdl:output name="response" message="tns:response"/>
    </wsdl:operation>
  </wsdl:portType>
 
  <wsdl:binding name="testBinding" type="tns:testType">
    <wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
    <wsdl:operation name="doSomething">
      <wsdlsoap:operation soapAction=""/>
      <wsdl:input name="request">
        <wsdlsoap:body use="literal"/>
      </wsdl:input>
      <wsdl:output name="response">
        <wsdlsoap:body use="literal"/>
      </wsdl:output>
    </wsdl:operation>
  </wsdl:binding>
 
  <wsdl:service name="test">
    <wsdl:port name="testPort" binding="tns:testBinding">
      <wsdlsoap:address location="http://example.org/bug-soap-array"/>
    </wsdl:port>
  </wsdl:service>
 
</wsdl:definitions>
 
raw

output.xml

1
2
3
4
5
6
7
8
9
10
11
12
13
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://example.org/bug-soap-array">
  <SOAP-ENV:Body>
    <ns1:request>
      <correctStrings>
        <string>foo</string>
        <string>foo2</string>
      </correctStrings>
      <brokenStrings/>
    </ns1:request>
  </SOAP-ENV:Body>
</SOAP-ENV:Envelope>
 
Christian Weiske Christian Weiske
owner

History