You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by Glen Daniels <gd...@macromedia.com> on 2002/01/29 18:58:58 UTC

FW: .NET literal and circular references

Forwarding this here too.  We should make sure that our code detects circular references when doing non-multiref serialization as well.

-----Original Message-----
From: Glen Daniels [mailto:gdaniels@macromedia.com]
Sent: Tuesday, January 29, 2002 12:54 PM
To: 'Jsr-101-Experts (E-mail)'
Subject: .NET literal and circular references



Tried it, you get this:

System.Exception: There was an error generating the XML document. ---> System.Exception: A circular reference was detected while serializing an object of type Literal+Data2.
   at System.Xml.Serialization.XmlSerializationWriter.WriteStartElement(String name, String ns, Object o, Boolean writePrefixed)
   at System.Xml.Serialization.XmlSerializationWriter.WriteStartElement(String name, String ns, Object o)
   at n2499d7d93ffa468fbd8861780677ee41.XmlSerializationWriter1.Write1_Data2(String n, String ns, Data2 o, Boolean isNullable, Boolean needType)
   at n2499d7d93ffa468fbd8861780677ee41.XmlSerializationWriter1.Write1_Data2(String n, String ns, Data2 o, Boolean isNullable, Boolean needType)
   at n2499d7d93ffa468fbd8861780677ee41.XmlSerializationWriter1.Write5_Data2(Object o)
   at System.Xml.Serialization.XmlSerializer.Serialize(XmlWriter xmlWriter, Object o, XmlSerializerNamespaces namespaces)
   at System.Xml.Serialization.XmlSerializer.Serialize(TextWriter textWriter, Object o)
   at System.Web.Services.Protocols.XmlReturnWriter.Write(HttpResponse response, Stream outputStream, Object returnValue)
   at System.Web.Services.Protocols.HttpServerProtocol.WriteReturns(Object[] returnValues, Stream outputStream)
   at System.Web.Services.Protocols.WebServiceHandler.WriteReturns(Object[] returnValues)
   at System.Web.Services.Protocols.WebServiceHandler.Invoke()
   at System.Web.Services.Protocols.WebServiceHandler.CoreProcessRequest()

Note that in addition to failing to handle circular references, literal does not allow you any concept that two data items are semantically "the same".

Therefore, I believe that for many common programming tasks, literal is not in fact going to be the way to go.

--Glen