php - 使用 php 将数组传递给 wsdl 文件无法正常工作
问题描述
我在 client.php 中定义了一个数组:
$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 工作不正常。我不明白它为什么起作用,即使数组中的值之一是整数值。我也使用简单类型,当我将一个整数值传递给定义为字符串的元素时,它不起作用。现在我想要,当我定义一切都应该是一个字符串时,它也不适用于数组中的整数 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>
推荐阅读
- mysql - 不同联合的 SQL 计数
- c# - XML Ref + Id 构造-> 自定义实现与否?
- c# - 禁用/启用当前的 Wi-Fi 适配器
- javascript - 查找给定的括号集是否有效
- tableau-api - 使用雪花 query_tag 跟踪 tableau 数据源使用情况
- spatial - Geopandas 空间连接 - x 米半径内的所有点
- mysql - DELETE FROM 在查询中引发 SQL 错误 [1064] [42000]: (conn=5159),SELECT 可以在该查询上工作
- mysql - 在mysql中创建临时表的问题
- python - 更改 Python 模块的权限,因此我不需要“sudo”我的 Python 脚本调用
- java - 在java中序列化json字符串而不转义引号