Cannot assign object of type  System.Xml.XmlNode[] to ArrayOfFileName

Version 1
    This document was generated from CDN thread

    Created by: Alex Merkulov on 08-12-2008 10:27:27 AM
    I pointed Visual studio to the CDROnDemand web service and it generated the reference map automatically.

    I then built a C# console app to call the reference map and was able to send a request to service.

    SOAP monitor tool shows my request -

    <?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:tns="http://schemas.cisco.com/ast/soap/" xmlns:types="http://schemas.cisco.com/ast/soap/encodedTypes" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Body soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><tns:get_file_list><in0 xsi:type="xsd:string">200808111400</in0><in1 xsi:type="xsd:string">200808111459</in1><in2 xsi:type="xsd:boolean">true</in2></tns:get_file_list></soap:Body></soap:Envelope>

    and this response -

    <?xml version="1.0" encoding="UTF-8"?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><soapenv:Body><ns1:get_file_listResponse soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns1="http://schemas.cisco.com/ast/soap/"><get_file_listReturn xsi:type="ns2:ArrayOfFileName" xmlns:ns2="http://ccm.cisco.com/serviceability/soap/cdrondemand"><FileName xsi:type="xsd:string">cdr_StandAloneCluster_04_200808111401_6350</FileName><FileName xsi:type="xsd:string">cdr_StandAloneCluster_01_200808111403_1265</FileName><FileName xsi:type="xsd:string">cdr_StandAloneCluster_05_200808111405_2412</FileName><FileName xsi:type="xsd:string">cmr_StandAloneCluster_04_200808111401_6350</FileName><FileName xsi:type="xsd:string">cmr_StandAloneCluster_05_200808111405_2412</FileName></get_file_listReturn></ns1:get_file_listResponse></soapenv:Body></soapenv:Envelope>

    the error I'm getting in my console application is -

    Cannot assign object of type System.Xml.XmlNode[] to an object of type cdrSync.com.serverName.ArrayOfFilename

    Any ideas how I can resolve this?

    Thank you!

    Alex

    Subject: Re: Cannot assign object of type  System.Xml.XmlNode[] to ArrayOfFileName
    Replied by: Mayank Sharma on 08-12-2008 01:37:46 PM
    I am not sure if this will help you but I had a similar problem in a proxy class. I was using WebdialerSoap.cs.

    I was getting a similar exception in the class. It seems like MS wsdl tool doesn't do the mapping right.

    There was a property in this class which was supposed to return a string array in my case but instead, it was returning a string.

    // Had to convert this from type string to type string[]

    // *****************************************************

    private string[] linesField;

    /// <remarks/>

    public string deviceName

    {

    get

    {

    return this.deviceNameField;

    }

    set

    {

    this.deviceNameField = value;

    }

    }

    /// <remarks/>

    // Had to convert this from type string to type string[]

    // *****************************************************

    Subject: Re: Cannot assign object of type  System.Xml.XmlNode[] to ArrayOfFileName
    Replied by: Alex Merkulov on 11-12-2008 12:52:58 PM
    Thanks for your response!

    This is what the auto-generated code for class for ArrayOfFileName looks like..

    Any ideas what I have to change to get it to convert properly?


    [url=http://System.SerializableAttribute()]http://System.SerializableAttribute()
    [url=http://System.Diagnostics.DebuggerStepThroughAttribute()]http://System.Diagnostics.DebuggerStepThroughAttribute()

    public partial class ArrayOfFileName {

    private string[] fileNameField;

    /// <remarks/>
    [url=http://System.Xml.Serialization.SoapElementAttribute(IsNullable=true)]http://System.Xml.Serialization.SoapElementAttribute(IsNullable=true)
    public string[] FileName {
    get {
    return this.fileNameField;
    }
    set {
    this.fileNameField = value;
    }
    }
    }

    Subject: RE: Cannot assign object of type  System.Xml.XmlNode[] to ArrayOfFileName
    Replied by: Sumesh Menon on 02-07-2009 05:00:10 AM
    Hi,
     
    I am also facing the same issue. PLease let me know if you have resolved this.
     
    Thanks,
    Sumesh