The reason is you store the value as a class variable. When you do so (and if you have deploy it on the request scope), every time you invoke the service it creates a new instances, thus it returns null. To solve the problem, you need to deploy the service in a higher level session scope (e.g., soap session or transport session) and store the value in ServiceConext. Please look at the following articles to get an understanding on session management.
http://wso2.org/library/articles/axis2-session-management http://wso2.org/library/articles/axis2-session-management-part-2 Deepal On 10/8/2010 4:16 AM, Meet wrote: > Hi, > I am struggling to find out the cause of this problem. > > //Webservice Code > public class WeatherService{ > Weather weather; > public void setWeather(Weather weather){ > this.weather = weather; > } > public Weather getWeather(){ > return this.weather; > } > } > //Client Code > WeatherServiceStub stub = new WeatherServiceStub > ("http://localhost:7001/axis2/services/WeatherService"); > > //Set Weather > sample.pojo.adbclient.WeatherServiceStub.Weather w1 = new > sample.pojo.adbclient.WeatherServiceStub.Weather(); > w1.setTemperature((float)39.3); > w1.setForecast("Cloudy with showers"); > w1.setRain(true); > w1.setHowMuchRain((float)4.5); > > SetWeather setW1 = new SetWeather(); > setW1.setWeather(w1); > stub.setWeather(setW1); > > //Get Weather > WeatherServiceStub.GetWeatherResponse res = stub.getWeather(); > WeatherServiceStub.Weather w2 = res.get_return(); > System.out.println("Temperature: " + w2.getTemperature()); > System.out.println("Forecast: " +w2.getForecast()); > System.out.println("Rain: " +w2.getRain()); > System.out.println("How much rain (in inches) : " +w2.getHowMuchRain()); > > The Weather object is being transferred to service properly. I can print it > and see it. But while returning the same back to the client, it returns > null. > > Any Idea? I Tried a lot for this. but being new bee in this field, dont know > much. > > Thanks, > Mitesh http://old.nabble.com/file/p29913368/WeatherService.wsdl > WeatherService.wsdl --------------------------------------------------------------------- To unsubscribe, e-mail: java-user-unsubscr...@axis.apache.org For additional commands, e-mail: java-user-h...@axis.apache.org