Hi! I can't get my service to work with sending arraylist. It works fine sending just one object but not the list here is my client code ============================================= package samples.demo;
import java.util.ArrayList; import java.util.List; import javax.xml.namespace.QName; import org.apache.axis2.AxisFault; import org.apache.axis2.addressing.EndpointReference; import org.apache.axis2.client.Options; import org.apache.axis2.rpc.client.RPCServiceClient; public class WeatherRPCClient { public static void main(String[] args1) throws AxisFault { RPCServiceClient serviceClient = new RPCServiceClient(); Options options = serviceClient.getOptions(); EndpointReference targetEPR = new EndpointReference("http://localhost:8080/axis2-book-1.1/services/WeatherService"); options.setTo(targetEPR); // Setting the weather QName opSetWeather = new QName("http://demo.samples", "setWeather"); Weather w = new Weather(); w.setTemperature((float)39.6); w.setForecast("Cloudy with showers"); w.setRain(true); w.setHowMuchRain((float)4.5); Weather w1 = new Weather(); w1.setTemperature((float)4.6); w1.setForecast("sunny day with showers"); w1.setRain(true); w1.setHowMuchRain((float)2.5); ArrayList<Weather> l = new ArrayList<Weather>(); l.add(w); l.add( w1 ); Object[] opSetWeatherArgs = new Object[] { l }; //serviceClient.invokeBlocking(opSetWeather, opSetWeatherArgs); serviceClient.invokeRobust(opSetWeather, opSetWeatherArgs); // Getting the weather QName opGetWeather = new QName("http://demo.samples", "getWeather"); Object[] opGetWeatherArgs = new Object[] { }; Class[] returnTypes = new Class[] { Weather.class }; Object[] response = serviceClient.invokeBlocking(opGetWeather, opGetWeatherArgs, returnTypes); Weather result = (Weather) response[0]; if (result == null) { System.out.println("Weather didn't initialize!"); return; } // Displaying the result System.out.println("Id : " + result.getId()); System.out.println("Temperature : " + result.getTemperature()); System.out.println("Forecast : " + result.getForecast()); System.out.println("Rain : " + result.getRain()); System.out.println("How much rain (in inches) : " + result.getHowMuchRain()); result.setForecast( "hehehe" ); opSetWeatherArgs = new Object[] { result }; //serviceClient.invokeBlocking(opSetWeather, opSetWeatherArgs); serviceClient.invokeRobust(opSetWeather, opSetWeatherArgs); } } ============================================= And here is my service ============================================= package samples.demo; import java.util.ArrayList; import org.hibernate.Session; public class WeatherService{ public void setWeather(ArrayList<Weather> weathers){ Session session = HibernateUtil.getSession(); HibernateUtil.beginTransaction(); for( Weather weather : weathers ){ if( weather.getId() != null ){ session.update(weather); }else{ session.persist(weather); } } HibernateUtil.commitTransaction(); HibernateUtil.closeSession(); } public Weather getWeather(){ Session session = HibernateUtil.getSession(); Weather w = ( Weather ) session.get(Weather.class, new Long( 1 )); HibernateUtil.closeSession(); return w; } } ============================================= When I'm calling setWeather I get this except ijava.lang.ClassCastException: org.apache.axiom.om.impl.llom.OMElementImpl cannot be cast to samples.demo.Weather at samples.demo.WeatherService.setWeather(WeatherService.java:14) seems like when I put Weather class In arraylist it gets cast? -- View this message in context: http://www.nabble.com/RPCServiceClient-and-ArrayList-tf4390198.html#a12517244 Sent from the Axis - User mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]