Yes, you hit the nail right on the head. The second example is exactly what
I'm doing. And sometimes it works  =)

If it's true that this is illegal, then it would seem impossible to serialize
a cyclical reference. . . unless. . . what about the following example:

<s:Envelope>
<s:Body>
<m:doSomething>
<p1 href="#b" />
<p2 href="#b" />
</m:doSomething>
<b id="b">
    <c href="#b" />
</b>
</s:Body>
</e:Envelope>

If this is legal, then the best approach might be to serialize everything
inside the root (parameters and return values) as an href. Then serialize the
actual data outside.

But this will work only if the serialized data outside the root, can use hrefs
that refer to itself.

Will that work? Do you know a good reference that discusses these issues?

Thanks a bunch,

-----Original Message-----
From: Simon Fell [mailto:[EMAIL PROTECTED]]
Sent: Thursday, September 20, 2001 18:22
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: Re: XML parser & cyclical reference question


Independent elements in SOAP [the one's that have id's] need to be
serialized outside of the main serialization root, e.g. they can not
be inlined, e.g.

<s:Envelope>
<s:Body>
<m:doSomething>
<p1 href="#b" />
<p2 href="#b" />
</m:doSomething>
<b id="b">5</b>
</s:Body>
</e:Envelope>

is correct, whilst this is not,

<s:Envelope>
<s:Body>
<m:doSomething>
<p1 id="b">5</p1>
<p2 href="#b" />
</m:doSomething>
</s:Body>
</e:Envelope>

from your description it sounds like you are generating the bottom
example.

Cheers
Simon

On Thu, 20 Sep 2001 15:29:23 -0700, in soap you wrote:

>Hi all,
>
>My Apache SOAP v 2.2 is installed & working with Jetty 3.0.6. I'm trying to
get data structures with cyclical references to marshal correctly. I've
modified the Apache SOAP source code to do this as follows:
>
>1. Every XML data item has a unique ID for it, whether or not this is needed.
>2. BeanSerializer detects duplicate objects or cycles, and in either case
generates an HREF XML tag to refer to the original item, instead of
serializing the item again.
>
>The XML it generates appears to always be valid, and sometimes it works. When
it does not work, the process that is unmarshalling the data (sometimes the
client, sometimes the server) complains that the XML HREF reference refers to
an ID tag that is "not defined" -- despite the fact that this tag is always
defined somewhere in the XML message.
>
>In other words, the unmarshaller sometimes matches the HREF to the ID and
successfully generates the objects. But other times, the unmarshaller
complains that it can't find the item to which the HREF refers (even though it
does exist in the XML message).
>
>In every case, I can look at the XML and see that the HREF tag always has a
matching ID tag, even when the parser says it couldn't be found.
>
>I'm wondering if there is some kind of namespace issue that might prevent the
HREF tags from matching back to the ID tags to which they refer. In other
words, even though the HREF string is unique and exactly matches the ID
string, some kind of namespace issue prevents the parser from matching them
up.
>
>This is probably a simple XML issue but I'm kinda new to XML so if anyone can
help point me in the right direction regarding HREF and ID, I would appreciate
it.
>
>Thanks,
>
>Michael R. Clements
>[EMAIL PROTECTED]
>Some find truth in beauty, others find beauty in truth.


Reply via email to