You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by "Chan, Philip" <Ph...@rbccm.com> on 2007/06/08 16:41:14 UTC
FW: AXIS2 POJO - how to use nested class as parameter?
Hi,
Is it possible to send an object within another object as a parameter
using POJO approach? Here is the example,
// two POJOs
public class ClassA {
public String id;
public long var1;
public ClassB b;
public ClassB[] barray;
}
public class ClassB {
public int var2;
public String str;
}
// server method
public class EchoService {
public ClassA echo (ClassA arg) {
return arg;
}
}
To implement this in Axis1, I would use <beanMapping> in deploy.wsdd on
server, something like:
<beanMapping qname="myNS:ClassA" xmlns:myNS="urn:BeanService"
languageSpecificType="java:ClassA"/>
<beanMapping qname="myNS:ClassB" xmlns:myNS="urn:BeanService"
languageSpecificType="java:ClassB"/>
and the following codes in client:
QName qnClassA = new QName( "urn:BeanService", "ClassA" );
QName qnClassB = new QName( "urn:BeanService", "ClassB" );
call.registerTypeMapping(ClassA.class, qnClassA,
new
org.apache.axis.encoding.ser.BeanSerializerFactory(ClassA.class,
qnClassA),
new
org.apache.axis.encoding.ser.BeanDeserializerFactory(ClassA.class,
qnClassA));
call.registerTypeMapping(ClassB.class, qnClassB,
new
org.apache.axis.encoding.ser.BeanSerializerFactory(ClassB.class,
qnClassB),
new
org.apache.axis.encoding.ser.BeanDeserializerFactory(ClassB.class,
qnClassB));
However, <beanMapping>, org.apache.axis.client.Call, and
registerTypeMapping are not supported in AXIS2. Can anyone give me
direction how to implement this in AXIS2 (both server and client)? Is
there an example related to nested objects as parameters? All examples
come with the package are dealing with simple object only. thanks
Philip
_______________________________________________________________________
This email is intended only for the use of the individual(s) to whom it is addressed and may be privileged and confidential.
Unauthorised use or disclosure is prohibited. If you receive This e-mail in error, please advise immediately and delete the original message.
This message may have been altered without your or our knowledge and the sender does not accept any liability for any errors or omissions in the message.
Ce courriel est confidentiel et protégé. L'expéditeur ne renonce pas aux droits et obligations qui s'y rapportent.
Toute diffusion, utilisation ou copie de ce message ou des renseignements qu'il contient par une personne autre que le (les) destinataire(s) désigné(s) est interdite.
Si vous recevez ce courriel par erreur, veuillez m'en aviser immédiatement, par retour de courriel ou par un autre moyen.
Re: FW: AXIS2 POJO - how to use nested class as parameter?
Posted by Deepal Jayasinghe <de...@opensource.lk>.
Hi Chan,
It is very simple,
what you have to do is write services.xml with RPC message receivers ,
and then create a service archive file and deploy.
Thanks
Deepal
> Hi,
>
> Is it possible to send an object within another object as a parameter
> using POJO approach? Here is the example,
>
> // two POJOs
> public class ClassA {
> public String id;
> public long var1;
> public ClassB b;
> public ClassB[] barray;
> }
> public class ClassB {
> public int var2;
> public String str;
> }
>
> // server method
> public class EchoService {
> public ClassA echo (ClassA arg) {
> return arg;
> }
> }
>
> To implement this in Axis1, I would use <beanMapping> in deploy.wsdd
> on server, something like:
>
> <beanMapping qname="myNS:ClassA" xmlns:myNS="urn:BeanService"
> languageSpecificType="java:ClassA"/>
>
> <beanMapping qname="myNS:ClassB" xmlns:myNS="urn:BeanService"
> languageSpecificType="java:ClassB"/>
>
>
> and the following codes in client:
>
> QName qnClassA = new QName( "urn:BeanService", "ClassA" );
> QName qnClassB = new QName( "urn:BeanService", "ClassB" );
>
> call.registerTypeMapping(ClassA.class, qnClassA,
> new
> org.apache.axis.encoding.ser.BeanSerializerFactory(ClassA.class,
> qnClassA),
> new
> org.apache.axis.encoding.ser.BeanDeserializerFactory(ClassA.class,
> qnClassA));
> call.registerTypeMapping(ClassB.class, qnClassB,
> new
> org.apache.axis.encoding.ser.BeanSerializerFactory(ClassB.class,
> qnClassB),
> new
> org.apache.axis.encoding.ser.BeanDeserializerFactory(ClassB.class,
> qnClassB));
>
>
> However, <beanMapping>, org.apache.axis.client.Call, and
> registerTypeMapping are not supported in AXIS2. Can anyone give me
> direction how to implement this in AXIS2 (both server and client)? Is
> there an example related to nested objects as parameters? All
> examples come with the package are dealing with simple object only.
> thanks
>
> Philip
> _______________________________________________________________________
>
> This email is intended only for the use of the individual(s) to whom it is addressed and may be privileged and confidential.
> Unauthorised use or disclosure is prohibited. If you receive This e-mail in error, please advise immediately and delete the original message.
> This message may have been altered without your or our knowledge and the sender does not accept any liability for any errors or omissions in the message.
>
> Ce courriel est confidentiel et protégé. L'expéditeur ne renonce pas aux droits et obligations qui s'y rapportent.
> Toute diffusion, utilisation ou copie de ce message ou des renseignements qu'il contient par une personne autre que le (les) destinataire(s) désigné(s) est interdite.
> Si vous recevez ce courriel par erreur, veuillez m'en aviser immédiatement, par retour de courriel ou par un autre moyen.
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org