I can see how this works with a class that we can map e.g. in your example
'samples.addressbook.Address' but what about returning the class
'java.lang.Object'
We have a general Soap server that currently returns a 'java.lang.Object[]'
but our clients want it to return a 'java.lang.Object' on which, they will
then use instanceof to cast into the correct type, it just produces the
error - 'No Serializer found to serialize a 'java.lang.Object'
Thanks,
Chris 

-----Original Message-----
From: Nicholas Quaine [mailto:[EMAIL PROTECTED]]
Sent: 04 December 2001 11:46
To: [EMAIL PROTECTED]
Subject: Re: returning Object vs Object[]


both are possible
ensure that your deployment descriptor contains a definition of only the
basic object (ie. do not attempt to declare an array)
the (de)serializer will work out how to do its work for any method that
requires or returns an array of such objects
as an example, the following excerpt from a deployment descriptor 'declares'
an object called Address
Once this is declared any method can then receive or return an Address or an
array of Address

<isd:map
  encodingStyle="http://schemas.xmlsoap.org/soap/encoding/";
  xmlns:x="urn:xml-soap-address-demo"
  qname="x:address"
  javaType="samples.addressbook.Address"
  java2XMLClassName="org.apache.soap.encoding.soapenc.BeanSerializer"
  xml2JavaClassName="org.apache.soap.encoding.soapenc.BeanSerializer" />

good luck

regards,
Nicholas Quaine

Visit http://www.soapuser.com/

[EMAIL PROTECTED]


----- Original Message -----
From: "Milburn, Christopher FIL" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, December 04, 2001 10:14 AM
Subject: returning Object vs Object[]


> Why can I return an 'Object' array from my soap server but not an 'Object'
> ie
> This works ok...
>
> public Object[] processCommand( String[] soapParams )
> {
> ...
>
>     Object[] obj = {(Object)"Fred Bloggs", (Object)"Jim Smith"};
>
>     return( obj );
> }
>
> but not this....
>
> public Object processCommand( String[] soapParams)
> {
> ...
>
>     Object obj = (Object)"Fred Bloggs";
>
>     return( obj );
> }
>
>
> It seems bizarre, Is this right ?
>
> Thanks,
>
> Chris Milburn
> [EMAIL PROTECTED]
> <mailto:[EMAIL PROTECTED]>
>

Reply via email to