[Mono-list] Recursive XML serialization? XML serialization of cyclic objects?

Robert Jordan robertj at gmx.net
Fri Jan 12 05:45:29 EST 2007


Andrés G. Aragoneses [ knocte ] wrote:
> Having this kind of object:
> 
>      class classA
>      {
>          int x;
>          classA z;
> 
>          public int X
>          {
>              get { return this.x; }
>              set { this.x = value; }
>          }
> 
>          public classA Z
>          {
>              get { return this.z; }
>              set { this.z = value; }
>          }
> 
>      }
> 
>      static class Program
>      {
>          static void Main(string[] args)
>          {
>              classA myObject = new classA();
>              myObject.X = 2;
>              myObject.Z = myObject;
>          }
>      }
> 
> 
> How can I send "myObject" via XML webservice for consumption? I am aware
> that this is not possible to be XML-serialized with .NET1.1 but, can I
> do it with 2.0 or Indigo?

I'm not aware of any Web Service standard allowing that
kind of cycles.

If you really need such complex classes and you don't
care about interop, you could switch to XSP/ASP.NET-hosted
.NET Remoting using a HttpChannel. This would require to design
the classes [Serializable], which is an issue of its own, though.

Anyway, my strong opinion is: *never* employ remoting or Web Services
w/out a remoting facade pattern that maps between complex objects
and simple (remotable) objects.

Robert



More information about the Mono-list mailing list