使用 PHP 将数组传递给 WSDL 文件无法正常工作



我在客户端中定义了一个数组。hp:

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

我使用$result1 = $client->__soapCall("function", array($array));将其传递到wsdl文件。

在我的wsdl中,它写着:

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

我认为我的wsdl工作不正常。我不明白为什么它能工作,即使数组中的一个值是整数值。我也使用简单类型,当我向定义为字符串的元素传递例如Integer值时,它不起作用。现在我想要的是,当我定义所有东西都应该是字符串时,它也不能处理数组中的整数13。因为我也有只允许包含整数的数组,当字符串值出现在这个数组中时,我的wsdl不应该传递那个数组。

问候

我让它与一起工作

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

和类型:

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

字符串:

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

在消息中:

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

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

最新更新