I have trouble with consuming another-party web service insInternet C#. It operates on Apache (NuSoap). Everything works normally as much as deserialization (most likely...). After I call the SoapHttpClientProtocol.Invoke() function, I usually have an object array with one null object. Bad is this fact web service does not give a WSDL document. :-(
Can anybody assist me to, please? I believe, the deserialization process does not run.
Here's cleaning soap response:
<?xml version="1.0" encoding="ISO-8859-1"?>
<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/">
<SOAP-ENV:Body>
<ns1:EncodingTestResponse xmlns:ns1="http://schemas.xmlsoap.org/soap/envelope/">
<item xmlns:ns4071="http://xml.apache.org/xml-soap" xsi:type="ns4071:Map">
<item>
<key xsi:type="xsd:string">ascii</key>
<value xsi:type="xsd:string">ertzyuuioasdcnERSTZYUIOADCN</value>
</item>
<item>
<key xsi:type="xsd:string">latin2</key>
<value xsi:type="xsd:string">xy</value>
</item>
<item>
<key xsi:type="xsd:string">w1250</key>
<value xsi:type="xsd:string">pq</value>
</item>
</item>
</ns1:EncodingTestResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
Calling method:
[SoapTrace]
[SoapDocumentMethod("EncodingTest",ParameterStyle=SoapParameterStyle.Wrapped)]
public item EncodingTest()
{
var obj = this.Invoke("EncodingTest", new object[] {});
return null;
}
and also the object, that we was attempting to deserialize:
[Serializable]
[XmlType(Namespace = "http://xml.apache.org/xml-soap", TypeName="item")]
public class item
{
[XmlArray("item", Form = XmlSchemaForm.Unqualified)]
public item[] items { get; set; }
[XmlElement(Form=XmlSchemaForm.Unqualified)]
public string key { get; set; }
[XmlElement(Form = XmlSchemaForm.Unqualified)]
public string value { get; set; }
}
I solve this, however it wasn't easy. A minimum of i learned controling xml deserialization.. :)
[SoapDocumentMethod(ResponseElementName = "EncodingTestResponse", ResponseNamespace = "http://schemas.xmlsoap.org/soap/envelope/")]
[return: XmlArray("item", Namespace = "", IsNullable = false)]
[SoapTrace]
public item[] EncodingTest()
{
object[] result = this.Invoke("EncodingTest", new object[] { });
return (item[])result[0];
}
[SoapType(TypeName = "Map", Namespace = "http://xml.apache.org/xml-soap")]
public class item
{
[XmlElement(Form = XmlSchemaForm.Unqualified)]
public string key { get; set; }
[XmlElement(Form = XmlSchemaForm.Unqualified)]
public string value { get; set; }
public item[] items { get; set; }
}