axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Akin Ayi" <a...@aaa.mv.com>
Subject FW: Axis: Help with correct typeMapping for JavaBean
Date Wed, 13 Nov 2002 20:40:47 GMT

There is considerable activity at this site, yet I did not get a single
response to my request below. Am I reaching the audience? Please send me
anything Ye or Nay at my addr, so I don't flood the axis-user group. If I
don't get anything within 3hrs I'll unsubscribe and re subscribe.

I am new to Axis, I sent the request to soap-user and Scott Nichols suggest
I try axis-user.

If more info is needed to help me out, please let me know.

thanks,
akin
akin@aaa.mv.com


-----Original Message-----
From: Akin Ayi [mailto:akin@aaa.mv.com]
Sent: Tuesday, November 12, 2002 3:07 PM
To: axis-user@xml.apache.org
Subject: Axis: Help with correct typeMapping for 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.
3) Is there a difernt way of doing this

thanks,
akin


Mime
View raw message