I can't answer for Axis, but this is one of the problems with XML being a unidirectional tree. The only way to do this in XML (that I am aware of) is use 'id' attributes and then refer to those id attributes in subsequent tags (you'll note this problem is similar in object-relational mapping). You could have either User or Group object (or both) not contain references to each other but merely unique ids to the respective object...or implement custom serializers to perform this under the covers.

Aaron

Andrew Hawkes wrote:

I'm having a problem with circular references during serialization.

For example, say I have two types: User and Group. User has a getGroup() method, and Group has a getUsers() method which returns an array of users.

Since this basically amounts to a circular reference, Axis goes into infinite recursion when it tries to serialize the response, and simply hangs forever spitting out huge log messages.

It seems like SOAP should have a more intelligent way to handle this. Is there a known solution, other than removing the circular reference from my objects?

Thanks,
Andrew




Reply via email to