Hi
!
Sorry
for my late answer,
a
Collection would do just fine !
I'd
appreciate to see your sample code !
Thanks
in advance
/Håkan
-----Ursprungligt meddelande-----
Från: Tony Blair [mailto:[EMAIL PROTECTED]
Skickat: den 27 februari 2004 19:35
Till: [EMAIL PROTECTED]
Ämne: Re: How to return array of beansHi there,I have a similar sample code. It takes a bean as an input but it returns a Collection of beans as oppose to an Array of beans. Is it possible for you to use Collection?Cheers,Tony.
Rosén_Håkan <[EMAIL PROTECTED]> wrote:Hi
I try to deploy a service but i'm stuck halfways.
I have written a small service that takes a javabean (Album) as input and
returns an array of the same bean (Album[]) as output,
I can call my service with a bean-parameter but when I return the array I
get a ClassCastException.
I think my problem is that i have to descibe the returning Array as well,
but i don't know how
the method in my service looks like :
public Album[] getAlbums( Album anAlbum ) {
wsdd-file:xmlns:java="http://xml.apache.org/axis/wsdd/providers/java"
xmlns:album="http://www.soapinterop.org/Album">http://www.soapinterop.org/Album languageSpecificType="java:company.beans.Album"/>
Extact from client-code:
Album[] result = new Album[0];
call.removeAllParameters();
call.setTargetEndpointAddress(endpointURL);
call.setUseSOAPAction(true);
call.setSOAPActionURI("http://www.soapinterop.org/Album");
QName albumqn = new QName("http://www.soapinterop.org/Album",
"Album");
Class cls = Album.class;
call.registerTypeMapping(cls,
albumqn,
BeanSerializerFactory.class,
BeanDeserializerFactory.class);
call.setOperationName( new QName("http://www.soapinterop.org/Album",
"getAlbums" ));
QName albumRetqn = new
QName("http://www.soapinterop.org/Album","ArrayOfAlbum");
call.registerTypeMapping(result.getClass(), albumRetqn,
ArraySerializerFactory.class, ArrayDeserializerFactory.class);
call.addParameter( "anAlbum", albumqn, ParameterMode.IN );
call.setReturnType(albumRetqn);
//invoking the call return in a ClassCastException
Object ret = call.invoke(new Object[] { anAlbum });
regards
/Håkan
Do you Yahoo!?
Get better spam protection with Yahoo! Mail