WebService return a Complex object ? Am i mad ?
-
I have created a super complex object and implemented all IXmlSerializable methods. And my webserice have to return this object from a method. Everything is almost fine. But i got a empty object returned from the method. I have debugged it also and I found that my webservice already have the object to return, but seem that my client didn't get the object back from the method ? How's come ??!!!! I have invoke the webservice alone, and it return a complete XML's object. But well .... don't know why my client's object got nothing !!!! Now I have to deserialize and serialize by myself from both server and client by passing a XML string, not the object class. But it looks so stupid if this is only way to do so !!! Please help. PS. In fact i have 2 - 3 simple classes that also passed between webservice and client and they are all fine .. but not the super complex object ??? becaseu it is too big ??
-
I have created a super complex object and implemented all IXmlSerializable methods. And my webserice have to return this object from a method. Everything is almost fine. But i got a empty object returned from the method. I have debugged it also and I found that my webservice already have the object to return, but seem that my client didn't get the object back from the method ? How's come ??!!!! I have invoke the webservice alone, and it return a complete XML's object. But well .... don't know why my client's object got nothing !!!! Now I have to deserialize and serialize by myself from both server and client by passing a XML string, not the object class. But it looks so stupid if this is only way to do so !!! Please help. PS. In fact i have 2 - 3 simple classes that also passed between webservice and client and they are all fine .. but not the super complex object ??? becaseu it is too big ??
I am not a guru at all, but we do here do some semi-complex custom class passing around with Web Services. My only though is, if your Class contains in turn classes, did you add the XMLInclude attribute? Here is an example, hope it's not too long winded
[Serializable] [XmlInclude(typeof(Discount)), XmlInclude(typeof(Expression)), XmlInclude(typeof(ExpressionClause))] public class OrderDiscounts { [XmlElement("OrderLevelDiscounts",typeof(Discount))] public Discount[] OrderLevelDiscounts; [XmlElement("ItemDiscounts",typeof(Discount))] public Discount[] ItemDiscounts; //... other properties } [Serializable] [XmlInclude(typeof(Expression)), XmlInclude(typeof(ExpressionClause))] public class Discount { [XmlElement("ConditionExpression",typeof(Expression))] public Expression ConditionExpression; //... other properties } [Serializable] [XmlInclude(typeof(ExpressionClause))] public class Expression { [XmlElement("ExpressionClauses",typeof(ExpressionClause))] public ExpressionClause[] ExpressionClauses; //... other properties } [Serializable] public class ExpressionClause { public string PropertyName; public string Operator; public string Value; }