Thanks Shameera Rathnayaka very much.
But I use wsdl2java generate client and invoke as follows:
WeatherServiceStub.SetWeather setWeather = new SetWeather();
WeatherServiceStub.Weather weather = new Weather();
weather.setTemperature(20.3f);
weather.setHowMuchRain(102.3f);
weather.setRain(true);
weather.setForecast("rain");
setWeather.setWeather(weather);
setWeather.setCountry("china");
WeatherServiceStub stub = new WeatherServiceStub(
"http://localhost:8080/axis2/services/WeatherService");
stub.setWeather(setWeather);
I have no chance to modify the soap message.
发件人: Shameera Rathnayaka [mailto:[email protected]]
发送时间: 2012年2月10日 星期五 22:28
收件人: [email protected]
主题: Re: somebody can help me
hi ,
try with this
<?xml version='1.0' encoding='UTF-8'?>
<soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope">
<soapenv:Body>
<ns2:setWeather xmlns:ns2="http://service.pojo.sample
<http://service.pojo.sample/> ">
<ns2:weather>
<ns1:forecast
xmlns:ns1="http://data.pojo.sample/xsd">rain</ns1:forecast>
<ns1:howMuchRain
xmlns:ns1="http://data.pojo.sample/xsd">102.3</ns1:howMuchRain>
<ns1:rain
xmlns:ns1="http://data.pojo.sample/xsd">true</ns1:rain>
<ns1:temperature
xmlns:ns1="http://data.pojo.sample/xsd">20.3</ns1:temperature>
</ns2:weather>
<ns2:city></ns2:city>
<ns2:country>china</ns2:country>
</ns2:setWeather>
</soapenv:Body>
</soapenv:Envelope>
2012/2/10 bohr.qiu <[email protected]>
I create a webservice with axis2 like that:
public void setWeather(@WebParam(name = "weather") Weather weather,
@WebParam(name = "city") String city,
@WebParam(name = "country") String country) {
System.out.println("weather:" + weather);
System.out.println("city:" + city);
System.out.println("country:" + country);
this.weather = weather;
}
Then I send a soap message :
<?xml version='1.0' encoding='UTF-8'?>
<soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope">
<soapenv:Body>
<ns2:setWeather xmlns:ns2="http://service.pojo.sample">
<ns2:weather>
<ns1:forecast
xmlns:ns1="http://data.pojo.sample/xsd">rain</ns1:forecast>
<ns1:howMuchRain
xmlns:ns1="http://data.pojo.sample/xsd">102.3</ns1:howMuchRain>
<ns1:rain
xmlns:ns1="http://data.pojo.sample/xsd">true</ns1:rain>
<ns1:temperature
xmlns:ns1="http://data.pojo.sample/xsd">20.3</ns1:temperature>
</ns2:weather>
<ns2:country>china</ns2:country>
</ns2:setWeather>
</soapenv:Body>
</soapenv:Envelope>
And I receive
weather:Weather [temperature=20.3, forecast=rain, rain=true, howMuchRain=102.3]
city:china
country:null
ns2:country node have been assigned null,why this happy ,please somebody help
me,thx.
--
Shameera Rathnayaka
Undergraduate
Department of Computer Science and Engineering
University of Moratuwa.
Sri Lanka.
Blog : http://shameerarathnayaka.blogspot.com/