Прокси-сервер Webservice возвращает пустой массив, но мыльный ответ действителен
Я пытаюсь использовать php webservice из клиента aC# windows. У меня нет доступа к сервисному коду. Я изменил wsdl для создания прокси-классов. Когда я вызываю check_connect(), который возвращает строку, все работает нормально. Когда я вызываю gettables(), которая возвращает массив сложных типов, я получаю пустой массив. Вероятно, это как-то связано с сериализацией, но я не могу найти проблему.
Это часть автоматически сгенерированного кода Refernce.cs.
[TraceExtensionAttribute(LogType.RequestReponse, "C:\\Log\\MyReq.log", "C:\\Log\\MyRes.log")]
[System.Web.Services.Protocols.SoapRpcMethodAttribute("http://dhmos-delfon.governing.gr/soap.php/gettables",
RequestNamespace="http://dhmos-delfon.governing.gr:10080/soap.php",
ResponseNamespace="http://dhmos-delfon.governing.gr:10080/soap.php",
Use=System.Web.Services.Description.SoapBindingUse.Literal)]
[return: System.Xml.Serialization.XmlArrayAttribute("return")]
[return: System.Xml.Serialization.XmlArrayItemAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable=false)]
public getapp[] gettables(string Username, string Password, string lang) {
object[] results = this.Invoke("gettables", new object[] {
Username,
Password,
lang});
return ((getapp[])(results[0]));
}
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "4.6.1586.0")]
[System.SerializableAttribute()]
//[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(Namespace="urn:governing_soap")]
public partial class getapp {
private string appField;
private string titleField;
private gettable[] tablesField;
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)]
public string app {
get {
return this.appField;
}
set {
this.appField = value;
}
}
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)]
public string title {
get {
return this.titleField;
}
set {
this.titleField = value;
}
}
/// <remarks/>
[System.Xml.Serialization.XmlArrayAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)]
[System.Xml.Serialization.XmlArrayItemAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable=false)]
public gettable[] tables {
get {
return this.tablesField;
}
set {
this.tablesField = value;
}
}
}
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "4.6.1586.0")]
[System.SerializableAttribute()]
//[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(Namespace="urn:governing_soap")]
public partial class gettable {
private string tableField;
private string titleField;
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)]
public string table {
get {
return this.tableField;
}
set {
this.tableField = value;
}
}
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)]
public string title {
get {
return this.titleField;
}
set {
this.titleField = value;
}
}
}
Это часть моего wsdl
<?xml version="1.0" encoding="utf-8"?>
<definitions
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:tns="urn:governing_soap"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns="http://schemas.xmlsoap.org/wsdl/"
targetNamespace="urn:governing_soap">
<types>
<xsd:schema targetNamespace="urn:governing_soap">
<xsd:import namespace="http://schemas.xmlsoap.org/soap/encoding/" schemaLocation="http://schemas.xmlsoap.org/soap/encoding/" />
<xsd:import namespace="http://schemas.xmlsoap.org/wsdl/" />
<xsd:complexType name="gettable">
<xsd:all>
<xsd:element name="table" type="xsd:string"/>
<xsd:element name="title" type="xsd:string"/>
</xsd:all>
</xsd:complexType>
<xsd:complexType name="tables">
<xsd:sequence>
<xsd:element name="gettable" type="tns:gettable" minOccurs="0" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="getapp">
<xsd:all>
<xsd:element name="app" type="xsd:string"/>
<xsd:element name="title" type="xsd:string"/>
<xsd:element name="tables" type="tns:tables"/>
</xsd:all>
</xsd:complexType>
<xsd:complexType name="getapps">
<xsd:sequence>
<xsd:element name="getapp" type="tns:getapp" minOccurs="0" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
</xsd:schema>
</types>
<message name="check_connectRequest"></message>
<message name="check_connectResponse">
<part name="return" type="xsd:string" /></message>
<message name="gettablesRequest">
<part name="Username" type="xsd:string" />
<part name="Password" type="xsd:string" />
<part name="lang" type="xsd:string" /></message>
<message name="gettablesResponse">
<part name="return" type="tns:getapps" /></message>
<portType name="governing_soapPortType">
<operation name="check_connect">
<input message="tns:check_connectRequest"/>
<output message="tns:check_connectResponse"/>
</operation>
<operation name="gettables">
<input message="tns:gettablesRequest"/>
<output message="tns:gettablesResponse"/>
</operation>
</portType>
<binding name="governing_soapBinding" type="tns:governing_soapPortType">
<soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
<operation name="check_connect">
<soap:operation soapAction="http://dhmos-delfon.governing.gr/soap.php/check_connect" style="rpc"/>
<input><soap:body use="literal" namespace="http://dhmos-delfon.governing.gr:10080/soap.php" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/></input>
<output><soap:body use="literal" namespace="http://dhmos-delfon.governing.gr:10080/soap.php" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/></output>
</operation>
<operation name="gettables">
<soap:operation soapAction="http://dhmos-delfon.governing.gr/soap.php/gettables" style="rpc"/>
<input><soap:body use="literal" namespace="http://dhmos-delfon.governing.gr:10080/soap.php" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/></input>
<output><soap:body use="literal" namespace="http://dhmos-delfon.governing.gr:10080/soap.php" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/></output>
</operation>
<service name="governing_soap">
<port name="governing_soapPort" binding="tns:governing_soapBinding">
<soap:address location="http://dhmos-delfon.governing.gr:10080/soap.php"/>
</port>
</service>
</definitions>
и это ответ, который я получаю.
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:tns="urn:governing_soap">
<SOAP-ENV:Body>
<ns1:gettablesResponse
xmlns:ns1="http://dhmos-delfon.governing.gr:10080/soap.php">
<return xsi:type="SOAP-ENC:Array" SOAP-ENC:arrayType="tns:getapp[2]">
<item xsi:type="tns:getapp">
<app xsi:type="xsd:string">organize</app>
<title xsi:type="xsd:string">organize</title>
<tables xsi:type="SOAP-ENC:Array" SOAP-ENC:arrayType="tns:gettable[3]">
<item xsi:type="tns:gettable">
<table xsi:type="xsd:string">chart</table>
<title xsi:type="xsd:string">chart</title>
</item>
<item xsi:type="tns:gettable">
<table xsi:type="xsd:string">chart_users</table>
<title xsi:type="xsd:string">chart_users</title>
</item>
<item xsi:type="tns:gettable">
<table xsi:type="xsd:string">diavgeia_units</table>
<title xsi:type="xsd:string">diavgeia_units</title>
</item>
</tables>
</item>
<item xsi:type="tns:getapp">
<app xsi:type="xsd:string">protocol</app>
<title xsi:type="xsd:string">protocol</title>
<tables xsi:type="SOAP-ENC:Array" SOAP-ENC:arrayType="tns:gettable[2]">
<item xsi:type="tns:gettable">
<table xsi:type="xsd:string">protocol_chart_users</table>
<title xsi:type="xsd:string">protocol_chart_users</title>
</item>
<item xsi:type="tns:gettable">
<table xsi:type="xsd:string">protocol_ex_document</table>
<title xsi:type="xsd:string">protocol_ex_document</title>
</item>
</tables>
</item>
</return>
</ns1:gettablesResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>