简体   繁体   中英

passing an array to wsdl file using php doesn't work properly

I have an array defined in in my client.php:

$array = array(13,"Maria","Mueller");

I pass it using $result1 = $client->__soapCall("function", array($array)); to the wsdl file.

in my wsdl it is written:

            <xsd:complexType name='function'>
                <xsd:sequence>
                    <xsd:element name='item' type='xsd:string' maxOccurs='unbounded'/>
                </xsd:sequence>
            </xsd:complexType>

I think my wsdl is not working properly. I don't understand why it works, even if one of the values in the array is an integer value. I also use simple types and when I pass eg an Integer value to an element that is defines as string, its not working. Now I want, that it is also not working with my integer 13 in the array when I define that everything should be a string. Because I also have arrays that are only allowed to include integers and my wsdl should not pass that arrays when a string value occurs in this arrays.

Greeting

I made it working with:

xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"

and in the types:

        <xsd:complexType name="function1">
            <xsd:complexContent>
                <xsd:restriction base="soapenc:Array">
                    <xsd:attribute ref="soapenc:arrayType" wsdl:arrayType="xsd:integer"/>
                </xsd:restriction>
            </xsd:complexContent>
        </xsd:complexType>

and for strings:

        <xsd:complexType name="function1">
            <xsd:complexContent>
                <xsd:restriction base="soapenc:Array">
                    <xsd:attribute ref="soapenc:arrayType" wsdl:arrayType="xsd:string"/>
                </xsd:restriction>
            </xsd:complexContent>
        </xsd:complexType>

and in the messages:

<wsdl:message name="createRequest1">
    <wsdl:part name="array" type='tns:function1'/>
</wsdl:message>

source: https://www.w3.org/TR/2001/NOTE-wsdl-20010315

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM