| 发表于:2007-12-20 11:16:27 楼主 |
webservice定义了父子类 父类 [serializable] public class fatherclass { private string id; public string id { get { return id;} set { id = value; } } } 子类 [serializable] public class childclass : fatherclass { private string childname; public string childname { get { return childname; } set { childname = value; } } } webservice定义 [xmlinclude(typeof(fatherclass))] [xmlinclude(typeof(childclass))] [webmethod] public fatherclasshellostus(fatherclass obj) { childclass child = (childclass)obj; .... return child; } 这样定义发布使用就没有问题,但是采用如下的定义方式,就会出现序列化错误,请问有什么方法解决呢? [webmethod] public fatherclasshellostus(fatherclass obj) { childclass child = (childclass)obj; .... return child; } 因为程序接口中有很多子类,如果不采用xmlinclude进行声明,有什么方法可以解决这种序列化的问题呢,程序接口中,只有自定义类或对象数组类型,不存在list类型。 |
|
|
|
|