You are viewing a plain text version of this content. The canonical link for it is here.
Posted to soap-dev@xml.apache.org by Manish Balsara <ma...@aumsoft.com> on 2001/04/12 04:05:52 UTC

Re: multi references

Let me try giving an example of arrays to indicate multi-references,

public class Animal
{
	public KeyValue(String type)
	{
		// code deleted for brevity
	}
}

Animal a1 = new Animal("dog");
Animal a2 = new Animal("cat");

Animal animalArray[] = new Animal[3];
animalArray[0] = a1;
animalArray[1] = a2;
animalArray[2] = a1;

when the array is marshalled, you could represent it as distinct elements,
(without multiple references). When the array gets unmarshalled it would
have 3 distinct objects and there would be no way to know that the
first and third elements pointed to the same object:
<SOAP-ENC:Body>   
...
<animalArray SOAP-ENC:arrayType="Animal[3]">
  <animal><type>dog</type></animal>
  <animal><type>cat</type></animal>
  <animal><type>dog</type></animal>
</animalArray>
...
</SOAP-ENC:Body>

OR

you can represent the data with multi-reference accessors, so that when
the array is unmarshalled, the first and third elements are the same
objects at the receiver, as they were on the sender's.
<SOAP-ENC:Body>
...
<animalArray SOAP-ENC:arrayType="Animal[3]">
  <animal href="#1"/>
  <animal><type>cat</type></animal>
  <animal href="#1"/>
</animalArray>
<animal id="1"><type><dog></type></animal>
...
</SOAP-ENC:Body>

best wishes,
manish

On Thu, 12 Apr 2001, Seumas Soltysik wrote:

> I have read the SOAP1.1 spec 4-5 times and read just about everything out 
> there relating to SOAP and I have found very little which describes how and 
> when to use multi-references in the creation of a SOAP message.
> The only concrete information on multi-references that I have found, 
> indicates that multi-references should be used if you are serializing two 
> object references that reference the same object/data. Can someone point me 
> to a reference or past email or a SOAP package that clearly explains when 
> and how to use multi-references.
> Thanks,
> Seumas Soltysik
> 
>