tags:

views:

294

answers:

1

Hi,

I'm having an issue with the WSDL generator in .NET. It is missing out on complex types in one specific method.

Response from web service

<?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="http://www.x.com/2.6.0"&gt;
<SOAP-ENV:Body>
 <ns1:Export.GetData xmlns:ns1="http://www.x.com/"&gt;
  <return xsi:type="tns:data_warehouse_report">
   <start_row xsi:type="xsd:int">1</start_row>
   <end_row xsi:type="xsd:int">2</end_row>
   <finished xsi:type="xsd:boolean">true</finished>
   <rows xsi:type="SOAP-ENC:Array" SOAP-ENC:arrayType="tns:data_warehouse_report_row[2]">
    <item xsi:type="SOAP-ENC:Array" SOAP-ENC:arrayType="xsd:string[3]">
     <item xsi:type="xsd:string">March 12, 2010</item>
     <item xsi:type="xsd:string">recipient3</item>
     <item xsi:type="xsd:string">sample product1</item>
    </item>
    <item xsi:type="SOAP-ENC:Array" SOAP-ENC:arrayType="xsd:string[0]"></item>
   </rows>
  </return>
 </ns1:Export.GetData>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>

Notice the lines:

<rows xsi:type="SOAP-ENC:Array" SOAP-ENC:arrayType="tns:data_warehouse_report_row[2]">
<item xsi:type="SOAP-ENC:Array" SOAP-ENC:arrayType="xsd:string[3]">

WSDL:

<xsd:complexType name="data_warehouse_report">
  <xsd:all>
    <xsd:element name="start_row" type="xsd:int"/>
    <xsd:element name="end_row" type="xsd:int"/>
    <xsd:element name="finished" type="xsd:boolean"/>
    <xsd:element name="rows" type="tns:data_warehouse_report_row_list"/>
  </xsd:all>
</xsd:complexType>

What is odd is that the type data_warehouse_report specifies the type rows as a "data_warehouse_report_list" which is not even used in the response.

My big question is.. According to the web service response, how would you create the proxy object data_warehouse_report_row?

I've translated it to:

[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.SoapTypeAttribute(Namespace = "http://www.x.com/")]
public partial class data_warehouse_report_row
{
    private string[] itemField;

    public string[] item
    {
        get
        {
            return this.itemField;
        }
        set
        {
            this.itemField = value;
        }
    }
}

But it still complaints about incorrect data type when deserializing..

Exception:

InvalidCastException: "Object cannot be stored in an array of this type."

I've tried using .NET reflector to debug the compiled assemblies (mainly System.Xml.Serialization), but the trace ends at the generated assembly created reader created by the serializer... So I haven't been able to figure out exactly what data it is trying to cast from.

Any ideas?

A: 

Hi,

I am stuck in the exact same situation. Were you able to find a solution for this ? Would really appreciate if you could share.

Thanks

Garfield