You are viewing a plain text version of this content. The canonical link for it is here.
Posted to soap-user@ws.apache.org by Scott Nichol <sn...@scottnichol.com> on 2002/11/12 19:17:03 UTC

Re: Help with correct typeMapping of JavaBean

Akin,

The axis-user@xml.apache.org list would be a better place for this
question.

Scott Nichol

----- Original Message -----
From: "Akin Ayi" <ak...@aaa.mv.com>
To: <so...@xml.apache.org>
Sent: Tuesday, November 12, 2002 4:05 PM
Subject: Axis: Help with correct typeMapping of JavaBean


>
> I am using Axis 1.0, Is this how to go about what I need to do ?
> //My service, EchoService, returns whatever I send in MyBean.
> // With a simple Bean structure, it works just fine.
>
> public class MyBean {
>   private String name = null;
>   private float price = 0.0f;
> // Get & Set Methods
> }
> The .wsdd has this for beanMapping
>  <beanMapping qname="myNS:MyBean"
>     xmlns:myNS="urn:EchoService"
>               languageSpecificType="java:book.MyBean"/>
>
> The Client performs the following registration before calling the
service
>   QName oiqn = new QName( "urn:EchoService", "myBean");
> Class cls1 = book.myBean.class;
>         call.registerTypeMapping(cls1, oiqn,
> new org.apache.axis.encoding.ser.BeanSerializerFactory
> (myBean.class,oiqn),
> new org.apache.axis.encoding.ser.BeanDeserializerFactory
> (myBean.class,oiqn));
>
>   // Set the input param type as follows
> call.addParameter("dataIn", oiqn, ParameterMode.IN);
>     // myBeanData is an instance of myBean correctly populated
> Object[] params = new Object[] {myBeanData };
> String result = (String) call.invoke(params);
> This works, my data was sent and echoed by the service CORRECLY.
> **********************************************
> I then modified myBean as shown below:
> 1) Added modifier field,
> 2) Created a Modifier class
> 3) Updated my .wsdd to include beanMapping for Modifier
> 4) In the Client, included Modifier when registering type mapping
>
> public class MyBean {
>   private String name = null;
>   private float price = 0.0f;
>   private Modifier [] modifier = new Modifier[4]; // class defined
below
> // Get & Set Methods
> }
>
> public class Modifier {
>   private String modName = null;
>   private String modType = null;
>   private int modQuantity = 0;
>   // Get & Set Methods
> }
>
> The .wsdd has this for beanMapping
>  <beanMapping qname="myNS:MyBean"
>     xmlns:myNS="urn:EchoService"
>               languageSpecificType="java:book.MyBean"/>
>  <beanMapping qname="myNS:Modifier"
>     xmlns:myNS="urn:EchoService"
>               languageSpecificType="java:book.Modifier"/>
>
> //Client2 performs the following registration before calling the
service
>   QName oiqn = new QName( "urn:EchoService", "myBean");
>   QName mdqn = new QName( "urn:EchoService", "Modifier");
> Class cls1 = book.myBean.class;
> Class cls2 = book.Modifier.class;
>         call.registerTypeMapping(cls1, oiqn,
> new org.apache.axis.encoding.ser.BeanSerializerFactory
> (myBean.class,oiqn),
> new org.apache.axis.encoding.ser.BeanDeserializerFactory
> (myBean.class,oiqn));
>       call.registerTypeMapping(cls2, mdqn,
> new org.apache.axis.encoding.ser.BeanSerializerFactory
> (Modifier.class,mdqn),
> new org.apache.axis.encoding.ser.BeanDeserializerFactory
> (Modifier.class,mdqn));
>   // Set the input param type as follows
> call.addParameter("dataIn", oiqn, ParameterMode.IN);
> // myBeanData is an instance of myBean correctly populated
> Object[] params = new Object[] {myBeanData };
> String result = (String) call.invoke(params);
>
> THE PROBLEM:
> Using Client2, when the outbound soap was generated it did not contain
the
> Modifier data. The updated service was expecting it.
> QUESTION:
> 1) What am I missing in Client2 that caused only part of myBean to be
> included in the soap.
> 2) The registration of myBean and Modifier are separate, how is the
> correlation between myBean and Modifier classes accomplished.
>
> thanks,
> akin
>
>
> --
> To unsubscribe, e-mail:
<ma...@xml.apache.org>
> For additional commands, e-mail:
<ma...@xml.apache.org>
>
>