You are viewing a plain text version of this content. The canonical link for it is here.
Posted to soap-user@ws.apache.org by Dan Costinett <da...@theplatform.com> on 2001/04/10 02:05:34 UTC

FW: Receive a complex return value

A question along these lines - why does the VectorSerializer encapsulate
the vector's elements within "item" tags?  And how can I avoid it?

I'd like to send a Vector of what look like Longs but have a mapped
type.  So, I have a class that extends Vector (MyVector) and another
class that has a single member of type long (MyLong).  I add the objects
I want to MyVector, but when the Vector gets Serialized, each of
MyVector's elements is enclosed in item tags.  I want:

<MyVector>
	<MyLong></MyLong>
	<MyLong></MyLong>
</MyVector>

but I get:

<MyVector>
	<item>
	<MyLong></MyLong>
	</item>
	<item>
	<MyLong></MyLong>
	</item>
</MyVector>


Is there a simple way to avoid the extraneous nesting?

TIA,
Dan Costinett
-----Original Message-----
From: Magnús Þór Torfason [mailto:magnus@handtolvur.is]
Sent: Monday, March 26, 2001 9:38 AM
To: soap-user@xml.apache.org
Subject: RE: Receive a complex return value



I was under the impression that SOAP, like xml-rpc, was able to
send/receive
Vectors and Hashtables as parameters.  Is this not the case, and if so,
is
there a reason why the xml-rpc code to to this has not been incorporated
into apache soap?

Magnus

>
> Yes, you can do that.  Set it up as a bean and use the beanserializer
to
> marshall the object, or write your own serializer though the
documentation
> on the particulars of writing your own do not exist.
>
> Bill
>
> > I wonder if you can return an object with these fields (Name,
> > Address and Phone).
> >
> > -P
> >


---------------------------------------------------------------------
To unsubscribe, e-mail: soap-user-unsubscribe@xml.apache.org
For additional commands, email: soap-user-help@xml.apache.org


Re: FW: Receive a complex return value

Posted by Aleksander Slominski <as...@cs.indiana.edu>.
Glen Daniels wrote:

> As it stands the VectorSerializer doesn't serialize directly to SOAP Arrays,
> preferring a custom encoding ("xmlsoap:Vector").  This is due to be fixed at
> some point, but we need a good way of getting Vectors back from serialized
> SOAP Arrays before that happens.

when you do deserialization you already know what is expected type (ie. Vector)
and you see that on the wire it is array so you just deserialize Vector

it sounds trivial _but_ it requires wither:
* to overwrite default xsi:type rule (that would chose array deserializer)
* or alternatively register a converter that takes array and converts into
expected type (vector). and it would mean adding generic type-type converters?

how does it sound?

alek
--
Aleksander Slominski, LH 316, IU, http://www.extreme.indiana.edu/~aslom
As I look afar I see neither cherry Nor tinted leaves Just a modest hut
on the coast In the dusk of Autumn nightfall - Fujiwara no Teika(1162-1241)



---------------------------------------------------------------------
To unsubscribe, e-mail: soap-user-unsubscribe@xml.apache.org
For additional commands, email: soap-user-help@xml.apache.org


Re: FW: Receive a complex return value

Posted by Olivier Brand <ol...@intraware.com>.
Glen,

I am not using the Vector Serializer for portability issues. In your case, you
could use the ArraySerializer and change the return type or input parameter from
Vector to Array. You could issue a vector.toArray().
I would write a VectorArraySerializer using the already existing ArraySerializer
(one or 2 lines of code should do the trick) so your vectors are being passed as
arrays (compliant with W3C SOAP).

Olivier


Glen Daniels wrote:

> Hi Olivier:
>
> As it stands the VectorSerializer doesn't serialize directly to SOAP Arrays,
> preferring a custom encoding ("xmlsoap:Vector").  This is due to be fixed at
> some point, but we need a good way of getting Vectors back from serialized
> SOAP Arrays before that happens.
>
> --Glen
>
> ----- Original Message -----
> From: "Olivier Brand" <ol...@intraware.com>
> To: <so...@xml.apache.org>
> Sent: Monday, April 09, 2001 8:22 PM
> Subject: Re: FW: Receive a complex return value
>
> Dan,
>
> If you look at the source code, you will notice that "item" is hardcoded.
> The SOAP specification is not really clear (especially the samples). I think
> that the name of the tag is not important "item" vs "MyLong". The extra
> nesting is annoying but it doesn't matter. You should not depend on the tag
> name to recreate the object but should read instead the XSD type definition
> for the Array (an ugly one) and "guess" the type using the arrayType
> attribute (from the soapenc namespace).
>
> Olivier
>
> Dan Costinett wrote:
>
> > A question along these lines - why does the VectorSerializer encapsulate
> > the vector's elements within "item" tags?  And how can I avoid it?
> >
> > I'd like to send a Vector of what look like Longs but have a mapped
> > type.  So, I have a class that extends Vector (MyVector) and another
> > class that has a single member of type long (MyLong).  I add the objects
> > I want to MyVector, but when the Vector gets Serialized, each of
> > MyVector's elements is enclosed in item tags.  I want:
> >
> > <MyVector>
> >         <MyLong></MyLong>
> >         <MyLong></MyLong>
> > </MyVector>
> >
> > but I get:
> >
> > <MyVector>
> >         <item>
> >         <MyLong></MyLong>
> >         </item>
> >         <item>
> >         <MyLong></MyLong>
> >         </item>
> > </MyVector>
> >
> > Is there a simple way to avoid the extraneous nesting?
> >
> > TIA,
> > Dan Costinett
> > -----Original Message-----
> > From: Magnús Þór Torfason [mailto:magnus@handtolvur.is]
> > Sent: Monday, March 26, 2001 9:38 AM
> > To: soap-user@xml.apache.org
> > Subject: RE: Receive a complex return value
> >
> > I was under the impression that SOAP, like xml-rpc, was able to
> > send/receive
> > Vectors and Hashtables as parameters.  Is this not the case, and if so,
> > is
> > there a reason why the xml-rpc code to to this has not been incorporated
> > into apache soap?
> >
> > Magnus
> >
> > >
> > > Yes, you can do that.  Set it up as a bean and use the beanserializer
> > to
> > > marshall the object, or write your own serializer though the
> > documentation
> > > on the particulars of writing your own do not exist.
> > >
> > > Bill
> > >
> > > > I wonder if you can return an object with these fields (Name,
> > > > Address and Phone).
> > > >
> > > > -P
> > > >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: soap-user-unsubscribe@xml.apache.org
> > For additional commands, email: soap-user-help@xml.apache.org
>
> ----------------------------------------------------------------------------
> ----
>
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: soap-user-unsubscribe@xml.apache.org
> > For additional commands, email: soap-user-help@xml.apache.org
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: soap-user-unsubscribe@xml.apache.org
> For additional commands, email: soap-user-help@xml.apache.org

Re: FW: Receive a complex return value

Posted by Aleksander Slominski <as...@cs.indiana.edu>.
Glen Daniels wrote:

> As it stands the VectorSerializer doesn't serialize directly to SOAP Arrays,
> preferring a custom encoding ("xmlsoap:Vector").  This is due to be fixed at
> some point, but we need a good way of getting Vectors back from serialized
> SOAP Arrays before that happens.

when you do deserialization you already know what is expected type (ie. Vector)
and you see that on the wire it is array so you just deserialize Vector

it sounds trivial _but_ it requires wither:
* to overwrite default xsi:type rule (that would chose array deserializer)
* or alternatively register a converter that takes array and converts into
expected type (vector). and it would mean adding generic type-type converters?

how does it sound?

alek
--
Aleksander Slominski, LH 316, IU, http://www.extreme.indiana.edu/~aslom
As I look afar I see neither cherry Nor tinted leaves Just a modest hut
on the coast In the dusk of Autumn nightfall - Fujiwara no Teika(1162-1241)



---------------------------------------------------------------------
To unsubscribe, e-mail: soap-user-unsubscribe@xml.apache.org
For additional commands, email: soap-user-help@xml.apache.org


Re: FW: Receive a complex return value

Posted by Olivier Brand <ol...@intraware.com>.
Glen,

I am not using the Vector Serializer for portability issues. In your case, you
could use the ArraySerializer and change the return type or input parameter from
Vector to Array. You could issue a vector.toArray().
I would write a VectorArraySerializer using the already existing ArraySerializer
(one or 2 lines of code should do the trick) so your vectors are being passed as
arrays (compliant with W3C SOAP).

Olivier


Glen Daniels wrote:

> Hi Olivier:
>
> As it stands the VectorSerializer doesn't serialize directly to SOAP Arrays,
> preferring a custom encoding ("xmlsoap:Vector").  This is due to be fixed at
> some point, but we need a good way of getting Vectors back from serialized
> SOAP Arrays before that happens.
>
> --Glen
>
> ----- Original Message -----
> From: "Olivier Brand" <ol...@intraware.com>
> To: <so...@xml.apache.org>
> Sent: Monday, April 09, 2001 8:22 PM
> Subject: Re: FW: Receive a complex return value
>
> Dan,
>
> If you look at the source code, you will notice that "item" is hardcoded.
> The SOAP specification is not really clear (especially the samples). I think
> that the name of the tag is not important "item" vs "MyLong". The extra
> nesting is annoying but it doesn't matter. You should not depend on the tag
> name to recreate the object but should read instead the XSD type definition
> for the Array (an ugly one) and "guess" the type using the arrayType
> attribute (from the soapenc namespace).
>
> Olivier
>
> Dan Costinett wrote:
>
> > A question along these lines - why does the VectorSerializer encapsulate
> > the vector's elements within "item" tags?  And how can I avoid it?
> >
> > I'd like to send a Vector of what look like Longs but have a mapped
> > type.  So, I have a class that extends Vector (MyVector) and another
> > class that has a single member of type long (MyLong).  I add the objects
> > I want to MyVector, but when the Vector gets Serialized, each of
> > MyVector's elements is enclosed in item tags.  I want:
> >
> > <MyVector>
> >         <MyLong></MyLong>
> >         <MyLong></MyLong>
> > </MyVector>
> >
> > but I get:
> >
> > <MyVector>
> >         <item>
> >         <MyLong></MyLong>
> >         </item>
> >         <item>
> >         <MyLong></MyLong>
> >         </item>
> > </MyVector>
> >
> > Is there a simple way to avoid the extraneous nesting?
> >
> > TIA,
> > Dan Costinett
> > -----Original Message-----
> > From: Magnús Þór Torfason [mailto:magnus@handtolvur.is]
> > Sent: Monday, March 26, 2001 9:38 AM
> > To: soap-user@xml.apache.org
> > Subject: RE: Receive a complex return value
> >
> > I was under the impression that SOAP, like xml-rpc, was able to
> > send/receive
> > Vectors and Hashtables as parameters.  Is this not the case, and if so,
> > is
> > there a reason why the xml-rpc code to to this has not been incorporated
> > into apache soap?
> >
> > Magnus
> >
> > >
> > > Yes, you can do that.  Set it up as a bean and use the beanserializer
> > to
> > > marshall the object, or write your own serializer though the
> > documentation
> > > on the particulars of writing your own do not exist.
> > >
> > > Bill
> > >
> > > > I wonder if you can return an object with these fields (Name,
> > > > Address and Phone).
> > > >
> > > > -P
> > > >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: soap-user-unsubscribe@xml.apache.org
> > For additional commands, email: soap-user-help@xml.apache.org
>
> ----------------------------------------------------------------------------
> ----
>
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: soap-user-unsubscribe@xml.apache.org
> > For additional commands, email: soap-user-help@xml.apache.org
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: soap-user-unsubscribe@xml.apache.org
> For additional commands, email: soap-user-help@xml.apache.org

Re: FW: Receive a complex return value

Posted by Glen Daniels <gd...@macromedia.com>.
Hi Olivier:

As it stands the VectorSerializer doesn't serialize directly to SOAP Arrays,
preferring a custom encoding ("xmlsoap:Vector").  This is due to be fixed at
some point, but we need a good way of getting Vectors back from serialized
SOAP Arrays before that happens.

--Glen

----- Original Message -----
From: "Olivier Brand" <ol...@intraware.com>
To: <so...@xml.apache.org>
Sent: Monday, April 09, 2001 8:22 PM
Subject: Re: FW: Receive a complex return value


Dan,

If you look at the source code, you will notice that "item" is hardcoded.
The SOAP specification is not really clear (especially the samples). I think
that the name of the tag is not important "item" vs "MyLong". The extra
nesting is annoying but it doesn't matter. You should not depend on the tag
name to recreate the object but should read instead the XSD type definition
for the Array (an ugly one) and "guess" the type using the arrayType
attribute (from the soapenc namespace).

Olivier


Dan Costinett wrote:

> A question along these lines - why does the VectorSerializer encapsulate
> the vector's elements within "item" tags?  And how can I avoid it?
>
> I'd like to send a Vector of what look like Longs but have a mapped
> type.  So, I have a class that extends Vector (MyVector) and another
> class that has a single member of type long (MyLong).  I add the objects
> I want to MyVector, but when the Vector gets Serialized, each of
> MyVector's elements is enclosed in item tags.  I want:
>
> <MyVector>
>         <MyLong></MyLong>
>         <MyLong></MyLong>
> </MyVector>
>
> but I get:
>
> <MyVector>
>         <item>
>         <MyLong></MyLong>
>         </item>
>         <item>
>         <MyLong></MyLong>
>         </item>
> </MyVector>
>
> Is there a simple way to avoid the extraneous nesting?
>
> TIA,
> Dan Costinett
> -----Original Message-----
> From: Magnús Þór Torfason [mailto:magnus@handtolvur.is]
> Sent: Monday, March 26, 2001 9:38 AM
> To: soap-user@xml.apache.org
> Subject: RE: Receive a complex return value
>
> I was under the impression that SOAP, like xml-rpc, was able to
> send/receive
> Vectors and Hashtables as parameters.  Is this not the case, and if so,
> is
> there a reason why the xml-rpc code to to this has not been incorporated
> into apache soap?
>
> Magnus
>
> >
> > Yes, you can do that.  Set it up as a bean and use the beanserializer
> to
> > marshall the object, or write your own serializer though the
> documentation
> > on the particulars of writing your own do not exist.
> >
> > Bill
> >
> > > I wonder if you can return an object with these fields (Name,
> > > Address and Phone).
> > >
> > > -P
> > >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: soap-user-unsubscribe@xml.apache.org
> For additional commands, email: soap-user-help@xml.apache.org




----------------------------------------------------------------------------
----


> ---------------------------------------------------------------------
> To unsubscribe, e-mail: soap-user-unsubscribe@xml.apache.org
> For additional commands, email: soap-user-help@xml.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: soap-user-unsubscribe@xml.apache.org
For additional commands, email: soap-user-help@xml.apache.org


Re: FW: Receive a complex return value

Posted by Glen Daniels <gd...@macromedia.com>.
Hi Olivier:

As it stands the VectorSerializer doesn't serialize directly to SOAP Arrays,
preferring a custom encoding ("xmlsoap:Vector").  This is due to be fixed at
some point, but we need a good way of getting Vectors back from serialized
SOAP Arrays before that happens.

--Glen

----- Original Message -----
From: "Olivier Brand" <ol...@intraware.com>
To: <so...@xml.apache.org>
Sent: Monday, April 09, 2001 8:22 PM
Subject: Re: FW: Receive a complex return value


Dan,

If you look at the source code, you will notice that "item" is hardcoded.
The SOAP specification is not really clear (especially the samples). I think
that the name of the tag is not important "item" vs "MyLong". The extra
nesting is annoying but it doesn't matter. You should not depend on the tag
name to recreate the object but should read instead the XSD type definition
for the Array (an ugly one) and "guess" the type using the arrayType
attribute (from the soapenc namespace).

Olivier


Dan Costinett wrote:

> A question along these lines - why does the VectorSerializer encapsulate
> the vector's elements within "item" tags?  And how can I avoid it?
>
> I'd like to send a Vector of what look like Longs but have a mapped
> type.  So, I have a class that extends Vector (MyVector) and another
> class that has a single member of type long (MyLong).  I add the objects
> I want to MyVector, but when the Vector gets Serialized, each of
> MyVector's elements is enclosed in item tags.  I want:
>
> <MyVector>
>         <MyLong></MyLong>
>         <MyLong></MyLong>
> </MyVector>
>
> but I get:
>
> <MyVector>
>         <item>
>         <MyLong></MyLong>
>         </item>
>         <item>
>         <MyLong></MyLong>
>         </item>
> </MyVector>
>
> Is there a simple way to avoid the extraneous nesting?
>
> TIA,
> Dan Costinett
> -----Original Message-----
> From: Magnús Þór Torfason [mailto:magnus@handtolvur.is]
> Sent: Monday, March 26, 2001 9:38 AM
> To: soap-user@xml.apache.org
> Subject: RE: Receive a complex return value
>
> I was under the impression that SOAP, like xml-rpc, was able to
> send/receive
> Vectors and Hashtables as parameters.  Is this not the case, and if so,
> is
> there a reason why the xml-rpc code to to this has not been incorporated
> into apache soap?
>
> Magnus
>
> >
> > Yes, you can do that.  Set it up as a bean and use the beanserializer
> to
> > marshall the object, or write your own serializer though the
> documentation
> > on the particulars of writing your own do not exist.
> >
> > Bill
> >
> > > I wonder if you can return an object with these fields (Name,
> > > Address and Phone).
> > >
> > > -P
> > >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: soap-user-unsubscribe@xml.apache.org
> For additional commands, email: soap-user-help@xml.apache.org




----------------------------------------------------------------------------
----


> ---------------------------------------------------------------------
> To unsubscribe, e-mail: soap-user-unsubscribe@xml.apache.org
> For additional commands, email: soap-user-help@xml.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: soap-user-unsubscribe@xml.apache.org
For additional commands, email: soap-user-help@xml.apache.org


Re: FW: Receive a complex return value

Posted by Olivier Brand <ol...@intraware.com>.
Dan,

If you look at the source code, you will notice that "item" is hardcoded.
The SOAP specification is not really clear (especially the samples). I think
that the name of the tag is not important "item" vs "MyLong". The extra
nesting is annoying but it doesn't matter. You should not depend on the tag
name to recreate the object but should read instead the XSD type definition
for the Array (an ugly one) and "guess" the type using the arrayType
attribute (from the soapenc namespace).

Olivier


Dan Costinett wrote:

> A question along these lines - why does the VectorSerializer encapsulate
> the vector's elements within "item" tags?  And how can I avoid it?
>
> I'd like to send a Vector of what look like Longs but have a mapped
> type.  So, I have a class that extends Vector (MyVector) and another
> class that has a single member of type long (MyLong).  I add the objects
> I want to MyVector, but when the Vector gets Serialized, each of
> MyVector's elements is enclosed in item tags.  I want:
>
> <MyVector>
>         <MyLong></MyLong>
>         <MyLong></MyLong>
> </MyVector>
>
> but I get:
>
> <MyVector>
>         <item>
>         <MyLong></MyLong>
>         </item>
>         <item>
>         <MyLong></MyLong>
>         </item>
> </MyVector>
>
> Is there a simple way to avoid the extraneous nesting?
>
> TIA,
> Dan Costinett
> -----Original Message-----
> From: Magnús Þór Torfason [mailto:magnus@handtolvur.is]
> Sent: Monday, March 26, 2001 9:38 AM
> To: soap-user@xml.apache.org
> Subject: RE: Receive a complex return value
>
> I was under the impression that SOAP, like xml-rpc, was able to
> send/receive
> Vectors and Hashtables as parameters.  Is this not the case, and if so,
> is
> there a reason why the xml-rpc code to to this has not been incorporated
> into apache soap?
>
> Magnus
>
> >
> > Yes, you can do that.  Set it up as a bean and use the beanserializer
> to
> > marshall the object, or write your own serializer though the
> documentation
> > on the particulars of writing your own do not exist.
> >
> > Bill
> >
> > > I wonder if you can return an object with these fields (Name,
> > > Address and Phone).
> > >
> > > -P
> > >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: soap-user-unsubscribe@xml.apache.org
> For additional commands, email: soap-user-help@xml.apache.org

Re: FW: Receive a complex return value

Posted by Olivier Brand <ol...@intraware.com>.
Dan,

If you look at the source code, you will notice that "item" is hardcoded.
The SOAP specification is not really clear (especially the samples). I think
that the name of the tag is not important "item" vs "MyLong". The extra
nesting is annoying but it doesn't matter. You should not depend on the tag
name to recreate the object but should read instead the XSD type definition
for the Array (an ugly one) and "guess" the type using the arrayType
attribute (from the soapenc namespace).

Olivier


Dan Costinett wrote:

> A question along these lines - why does the VectorSerializer encapsulate
> the vector's elements within "item" tags?  And how can I avoid it?
>
> I'd like to send a Vector of what look like Longs but have a mapped
> type.  So, I have a class that extends Vector (MyVector) and another
> class that has a single member of type long (MyLong).  I add the objects
> I want to MyVector, but when the Vector gets Serialized, each of
> MyVector's elements is enclosed in item tags.  I want:
>
> <MyVector>
>         <MyLong></MyLong>
>         <MyLong></MyLong>
> </MyVector>
>
> but I get:
>
> <MyVector>
>         <item>
>         <MyLong></MyLong>
>         </item>
>         <item>
>         <MyLong></MyLong>
>         </item>
> </MyVector>
>
> Is there a simple way to avoid the extraneous nesting?
>
> TIA,
> Dan Costinett
> -----Original Message-----
> From: Magnús Þór Torfason [mailto:magnus@handtolvur.is]
> Sent: Monday, March 26, 2001 9:38 AM
> To: soap-user@xml.apache.org
> Subject: RE: Receive a complex return value
>
> I was under the impression that SOAP, like xml-rpc, was able to
> send/receive
> Vectors and Hashtables as parameters.  Is this not the case, and if so,
> is
> there a reason why the xml-rpc code to to this has not been incorporated
> into apache soap?
>
> Magnus
>
> >
> > Yes, you can do that.  Set it up as a bean and use the beanserializer
> to
> > marshall the object, or write your own serializer though the
> documentation
> > on the particulars of writing your own do not exist.
> >
> > Bill
> >
> > > I wonder if you can return an object with these fields (Name,
> > > Address and Phone).
> > >
> > > -P
> > >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: soap-user-unsubscribe@xml.apache.org
> For additional commands, email: soap-user-help@xml.apache.org

Re: Receive a complex return value

Posted by Glen Daniels <gd...@macromedia.com>.
So you've got a class like this:

public class MyClass {
  public long MyLong;
  public long getMyLong() { return MyLong; };
  public void setMyLong(long val) { MyLong = val; };
}

...and you have a Vector of those?  If that's the case, the serializer is
doing the right thing, i.e.:

<vector>
 <item xsi:type="yourNS:MyClass"><MyLong>5.03</MyLong></item>
 <item xsi:type="yourNS:MyClass"><MyLong>0</MyLong></item>
</vector>

If you had a Vector of Longs, you'd get:

<vector>
 <item xsi:type="long">5.03</item>
 <item xsi:type="long>0</item>
</vector>

"item" is always the name of the sub-elements inside a serialized Vector in
Apache SOAP.  This is a placeholder because the items in a Vector are only
identified by ordinal position.  So the nesting is not extraneous, it's just
to delineate the individual things in the Vector.

--Glen

----- Original Message -----
From: "Dan Costinett" <da...@theplatform.com>
To: <so...@xml.apache.org>
Sent: Monday, April 09, 2001 8:05 PM
Subject: FW: Receive a complex return value



A question along these lines - why does the VectorSerializer encapsulate
the vector's elements within "item" tags?  And how can I avoid it?

I'd like to send a Vector of what look like Longs but have a mapped
type.  So, I have a class that extends Vector (MyVector) and another
class that has a single member of type long (MyLong).  I add the objects
I want to MyVector, but when the Vector gets Serialized, each of
MyVector's elements is enclosed in item tags.  I want:

<MyVector>
<MyLong></MyLong>
<MyLong></MyLong>
</MyVector>

but I get:

<MyVector>
<item>
<MyLong></MyLong>
</item>
<item>
<MyLong></MyLong>
</item>
</MyVector>


Is there a simple way to avoid the extraneous nesting?

TIA,
Dan Costinett
-----Original Message-----
From: Magnús Þór Torfason [mailto:magnus@handtolvur.is]
Sent: Monday, March 26, 2001 9:38 AM
To: soap-user@xml.apache.org
Subject: RE: Receive a complex return value



I was under the impression that SOAP, like xml-rpc, was able to
send/receive
Vectors and Hashtables as parameters.  Is this not the case, and if so,
is
there a reason why the xml-rpc code to to this has not been incorporated
into apache soap?

Magnus

>
> Yes, you can do that.  Set it up as a bean and use the beanserializer
to
> marshall the object, or write your own serializer though the
documentation
> on the particulars of writing your own do not exist.
>
> Bill
>
> > I wonder if you can return an object with these fields (Name,
> > Address and Phone).
> >
> > -P
> >


---------------------------------------------------------------------
To unsubscribe, e-mail: soap-user-unsubscribe@xml.apache.org
For additional commands, email: soap-user-help@xml.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: soap-user-unsubscribe@xml.apache.org
For additional commands, email: soap-user-help@xml.apache.org


Re: Receive a complex return value

Posted by Glen Daniels <gd...@macromedia.com>.
So you've got a class like this:

public class MyClass {
  public long MyLong;
  public long getMyLong() { return MyLong; };
  public void setMyLong(long val) { MyLong = val; };
}

...and you have a Vector of those?  If that's the case, the serializer is
doing the right thing, i.e.:

<vector>
 <item xsi:type="yourNS:MyClass"><MyLong>5.03</MyLong></item>
 <item xsi:type="yourNS:MyClass"><MyLong>0</MyLong></item>
</vector>

If you had a Vector of Longs, you'd get:

<vector>
 <item xsi:type="long">5.03</item>
 <item xsi:type="long>0</item>
</vector>

"item" is always the name of the sub-elements inside a serialized Vector in
Apache SOAP.  This is a placeholder because the items in a Vector are only
identified by ordinal position.  So the nesting is not extraneous, it's just
to delineate the individual things in the Vector.

--Glen

----- Original Message -----
From: "Dan Costinett" <da...@theplatform.com>
To: <so...@xml.apache.org>
Sent: Monday, April 09, 2001 8:05 PM
Subject: FW: Receive a complex return value



A question along these lines - why does the VectorSerializer encapsulate
the vector's elements within "item" tags?  And how can I avoid it?

I'd like to send a Vector of what look like Longs but have a mapped
type.  So, I have a class that extends Vector (MyVector) and another
class that has a single member of type long (MyLong).  I add the objects
I want to MyVector, but when the Vector gets Serialized, each of
MyVector's elements is enclosed in item tags.  I want:

<MyVector>
<MyLong></MyLong>
<MyLong></MyLong>
</MyVector>

but I get:

<MyVector>
<item>
<MyLong></MyLong>
</item>
<item>
<MyLong></MyLong>
</item>
</MyVector>


Is there a simple way to avoid the extraneous nesting?

TIA,
Dan Costinett
-----Original Message-----
From: Magnús Þór Torfason [mailto:magnus@handtolvur.is]
Sent: Monday, March 26, 2001 9:38 AM
To: soap-user@xml.apache.org
Subject: RE: Receive a complex return value



I was under the impression that SOAP, like xml-rpc, was able to
send/receive
Vectors and Hashtables as parameters.  Is this not the case, and if so,
is
there a reason why the xml-rpc code to to this has not been incorporated
into apache soap?

Magnus

>
> Yes, you can do that.  Set it up as a bean and use the beanserializer
to
> marshall the object, or write your own serializer though the
documentation
> on the particulars of writing your own do not exist.
>
> Bill
>
> > I wonder if you can return an object with these fields (Name,
> > Address and Phone).
> >
> > -P
> >


---------------------------------------------------------------------
To unsubscribe, e-mail: soap-user-unsubscribe@xml.apache.org
For additional commands, email: soap-user-help@xml.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: soap-user-unsubscribe@xml.apache.org
For additional commands, email: soap-user-help@xml.apache.org