当我尝试调用用 PHP Web 服务编写的 Web 方法时,我在 .NET 项目中收到“SOAP-ERROR: Encoding: object has not 'first_name' property”错误消息。Web 方法返回一个 PHP 数组$result_data。我已经在 WSDL 中为数组返回的字段添加了元素。由于我是 PHP 新手,无法获得返回数组的结构。该数组似乎是两个级别的。
$result_data => array(array( "first_name"
"last_name")
array( "first_name"
"last_name")
array( "first_name"
"last_name")
)
Run Code Online (Sandbox Code Playgroud)
这是我的 WSDL:
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"
xmlns:tns="http://10.20.1.161/api/soap/"
xmlns:s="http://www.w3.org/2001/XMLSchema"
xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/"
xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"
targetNamespace="http://10.20.1.161/api/soap/"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
<wsdl:types>
<s:schema targetNamespace="http://10.20.1.161/api/soap/" elementFormDefault="qualified">
<s:import namespace="http://microsoft.com/wsdl/types/"/>
<s:element name="getUsers">
<s:complexType>
<s:sequence>
<s:element minOccurs="1" maxOccurs="1" name="message" type="s:string"/>
</s:sequence>
</s:complexType>
</s:element>
<s:element name="getUsersResponse">
<s:complexType>
<s:sequence>
<s:element name="getUsersArray" type="tns:getUsersArray"/>
</s:sequence>
</s:complexType>
</s:element>
<s:complexType …Run Code Online (Sandbox Code Playgroud)