web service can't serialize an interface

后端 未结 3 1089
小鲜肉
小鲜肉 2021-01-04 21:36

I have an interface like so:

public interface IDocument : ISerializable
{
    Boolean HasBeenUploaded { get; set; }
    void ISerializable.GetObjectData(Seri         


        
3条回答
  •  生来不讨喜
    2021-01-04 22:03

    You may need to use an XmlInclude attribute to your web method. A example can be found here. We have run into this issue before and have added XmlInclude attributes to both our web service proxy class on the client and to certain web service methods.

    [WebMethod]
    [XmlInclude(typeof(MyDocument))]
    public Boolean ReceiveDocument(IDocument document)
    {
        DBIO io = new DBIO();
    
        return io.InsertIntoDB(document); // does nothing; just returns true
    }
    

提交回复
热议问题