Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C#
  4. WebService return a Complex object ? Am i mad ?

WebService return a Complex object ? Am i mad ?

Scheduled Pinned Locked Moved C#
sysadminxmlhelpquestion
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Offline
    T Offline
    Tee
    wrote on last edited by
    #1

    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 ??

    S 1 Reply Last reply
    0
    • T Tee

      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 ??

      S Offline
      S Offline
      Susan Hernandez
      wrote on last edited by
      #2

      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; }

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups