I get the impression that you're better off using arrays rather than Java
collections, perhaps something like this (and I've not compiled or tested
this):
public class PersonBean
{
private ArrayList telefon; // collection of TelefonBean
public TelefonBean [] getTelefon()
{
return (TelefonBean[])(this.telefon.toArray(new TelefonBean[0]));
}
public void setTelefon(TelefonBean [] telefon)
{
// convert from instrinsic array to ArrayList
}
}
From: "Scheid, Michael" <[EMAIL PROTECTED]>
Reply-To: axis-user@ws.apache.org
To: <axis-user@ws.apache.org>
Subject: bean-problem
Date: Mon, 16 Jan 2006 15:32:16 +0100
Hi,
I have a big problem to work with an bean that hold another beans in an
ArrayList.
The bean-class looks like this:
public class PersonBean {
private String uid;
private String nachname;
private String vorname;
private String geburtsdatum;
private ArrayList attribut;
private ArrayList anschrift;
private ArrayList telefon;
private ArrayList email;
....
}
attribut, anschrift, telefon and email are another bean-classes. I tried in
my test-client to call the service, after I register the serializer and
desializer:
QName person = new QName("urn:PersonBeanService", "PersonBean");
call.registerTypeMapping(PersonBean.class, person,
new BeanSerializerFactory(PersonBean.class, person),
new BeanDeserializerFactory(PersonBean.class,
person));
QName email = new QName("urn:EMailService", "EMail");
call.registerTypeMapping(EMail.class, email,
new BeanSerializerFactory(EMail.class, email),
new BeanDeserializerFactory(EMail.class, email));
QName anschrift = new QName("urn:AnschriftService",
"Anschrift");
call.registerTypeMapping(Anschrift.class, anschrift,
new BeanSerializerFactory(Anschrift.class, anschrift),
new BeanDeserializerFactory(Anschrift.class,
anschrift));
QName telefon = new QName("urn:TelefonService", "Telefon");
call.registerTypeMapping(Telefon.class, telefon,
new BeanSerializerFactory(Telefon.class, telefon),
new BeanDeserializerFactory(Telefon.class, telefon));
QName attribut = new QName("urn:AttributService", "Attribut");
call.registerTypeMapping(Attribut.class, attribut,
new BeanSerializerFactory(Attribut.class, attribut),
new BeanDeserializerFactory(Attribut.class,
attribut));
and in the deploy-descriptor:
<beanMapping qname="myNS:PersonBean" xmlns:myNS="urn:PersonBeanService"
languageSpecificType="java:psv.beans.PersonBean"/>
<beanMapping qname="myNS:EMail" xmlns:myNS="urn:EMailService"
languageSpecificType="java:psv.beans.EMail"/>
<beanMapping qname="myNS:Telefon" xmlns:myNS="urn:TelefonService"
languageSpecificType="java:psv.beans.Telefon"/>
<beanMapping qname="myNS:Anschrift" xmlns:myNS="urn:AnschriftService"
languageSpecificType="java:psv.beans.Anschrift"/>
<beanMapping qname="myNS:Attribut" xmlns:myNS="urn:AttributService"
languageSpecificType="java:psv.beans.Attribut"/>
Before I tried to work with the ArrayLists in my personbean (i tried this,
because it should be possible that a person have more than one adress,
email, telefon and attributs) it works fine.
Has anybody an idea, how i can get this new personbean containing another
beans to work? Or isnĀ“t that case possible to send with one call over the
wire? Have I to split my call on the client side in person, adress,
telefon, email, attribute and put the parts together on the service-side?
Thanks for your help,
Michael
_________________________________________________________________
On the road to retirement? Check out MSN Life Events for advice on how to
get there! http://lifeevents.msn.com/category.aspx?cid=Retirement