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 Suzy Fynes <su...@sentenial.ie> on 2005/03/01 18:02:20 UTC

object as parameter

 
Hi,
 
Can anyone tell if there is a different approach to adding a java bean
(simple types) as a parameter for an axis web service using a java
client.
 
For strings and ints the following is used
 
call.addParameter("name", XMLType.XSD_STRING, ParameterMode.IN);
 
what would be used if the parameter is an bean object?
 
Thanks
Suzy

RE: object as parameter

Posted by Suzy Fynes <su...@sentenial.ie>.
Thanks for that!
Just one more question, if there is more than one bean class do I do a
type mapping for each one?

Thanks

-----Original Message-----
From: jayachandra [mailto:jayachandra@gmail.com] 
Sent: 02 March 2005 06:08
To: axis-user@ws.apache.org
Subject: Re: object as parameter

There is Call.registerTypeMapping method. First register your bean to
some XMLType QName and then use that XMLType in the addParameter. That
should do the job.

e.g.
/* obtain instances of BeanSerializerFactory and
BeanDeserializerFactory as sf and df respecitively
*/
MyXMLType = new QName("http://sample.org/xsd","BeanXMLType");
Call.registerTypeMapping(MyBean.class, MyXMLType,sf,df);
...
...
Call.addParameter(...)
Call.addParameter("BeanParam", MyXMLType, ParameterMode.IN);
Call.addParameter(...)
...

Hope that helps,
Jayachandra

On Tue, 1 Mar 2005 17:02:20 -0000, Suzy Fynes
<su...@sentenial.ie> wrote:
> 
> 
>  
> 
> Hi,
> 
>  
> 
> Can anyone tell if there is a different approach to adding a java bean
> (simple types) as a parameter for an axis web service using a java
client.
> 
>  
> 
> For strings and ints the following is used
> 
>  
> 
> call.addParameter("name", XMLType.XSD_STRING, ParameterMode.IN);
> 
>  
> 
> what would be used if the parameter is an bean object?
> 
>  
> 
> Thanks
> 
> Suzy


-- 
-- Jaya




Re: object as parameter

Posted by jayachandra <ja...@gmail.com>.
There is Call.registerTypeMapping method. First register your bean to
some XMLType QName and then use that XMLType in the addParameter. That
should do the job.

e.g.
/* obtain instances of BeanSerializerFactory and
BeanDeserializerFactory as sf and df respecitively
*/
MyXMLType = new QName("http://sample.org/xsd","BeanXMLType");
Call.registerTypeMapping(MyBean.class, MyXMLType,sf,df);
...
...
Call.addParameter(...)
Call.addParameter("BeanParam", MyXMLType, ParameterMode.IN);
Call.addParameter(...)
...

Hope that helps,
Jayachandra

On Tue, 1 Mar 2005 17:02:20 -0000, Suzy Fynes
<su...@sentenial.ie> wrote:
> 
> 
>  
> 
> Hi,
> 
>  
> 
> Can anyone tell if there is a different approach to adding a java bean
> (simple types) as a parameter for an axis web service using a java client.
> 
>  
> 
> For strings and ints the following is used
> 
>  
> 
> call.addParameter("name", XMLType.XSD_STRING, ParameterMode.IN);
> 
>  
> 
> what would be used if the parameter is an bean object?
> 
>  
> 
> Thanks
> 
> Suzy


-- 
-- Jaya