WCF Web服务无法正常工作由于数据类型的合同

时间:2012-10-10 14:18:00

标签: wcf web-services

当我通过“ WcfTestClient ”测试我的WCF网络服务时,它正在显示

wcf测试客户端不支持此操作,因为它使用类型VINDescription

VINDescription是一个DataContract,,它由以下类型的数据名称组成:

"int, string, ArrayList"

WCF Web服务似乎不支持ArrayList?

请建议我该如何解决这个问题?

以下是DataContract的代码段:

[DataContract]
public class VINDescription
{
    #region Private Members

    private int _cylinders = 0;
    private string _msrp = string.Empty;
    private ArrayList _interior = new ArrayList();
    private string[][] _showOptionalEquipment = new string[][] { };

    #endregion

    #region Public Data Members

    /// <summary>
    /// Stores the number of cylinders of a decoded vehicle.
    /// </summary>
    [DataMember]
    public int Cylinders
    {
        get
        {
            return _cylinders;
        }
        set
        {
            _cylinders = value;
        }
    }

    /// <summary>
    /// Stores the MSRP cost of a decoded vehicle.
    /// </summary>
    [DataMember]
    public string MSRP
    {
        get
        {
            return _msrp;
        }
        set
        {
            _msrp = value;
        }
    }

    /// <summary>
    /// Stores the interior values of a decoded vehicle.
    /// </summary>
    [DataMember]
    public ArrayList Interior
    {
        get
        {
            _interior.Sort();
            return _interior;
        }
        set
        {
            _interior = value;
        }
    }



    /// <summary>
    /// To store the data for show optional equipments.
    /// </summary>
    [DataMember]
    public string[][] ShowOptionalEquipment
    {
        get
        {
            return _showOptionalEquipment;
        }
        set
        {
            _showOptionalEquipment = value;
        }
    }

1 个答案:

答案 0 :(得分:0)

我理解它的方式,WCF实际上支持您的数据协定,但WCF测试客户端工具不支持WCF本身支持的所有内容,因此错误。不确定它是否是因为ArrayList,string [] []或其他东西,但无论如何它似乎是一个工具限制,而不是框架限制。