You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by "bohr.qiu" <bo...@gmail.com> on 2012/02/11 05:40:59 UTC

答复: somebody can help me

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:shameerainfo@gmail.com] 
发送时间: 2012年2月10日 星期五 22:28
收件人: java-user@axis.apache.org
主题: 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 <bo...@gmail.com>

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/


Re: 答复: somebody can help me

Posted by Shameera Rathnayaka <sh...@gmail.com>.
Which version of axis2 you are using? because i tried with axis2 1.7
(trunk) it woks fine. city has assigned to null.  i deployed my service as
a pojo service.

2012/2/11 Shameera Rathnayaka <sh...@gmail.com>

>
>
>
> On Sat, Feb 11, 2012 at 10:10 AM, bohr.qiu <bo...@gmail.com> wrote:
>
>> 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:shameerainfo@gmail.com]
>> *发送时间:* 2012年2月10日 星期五 22:28
>> *收件人:* java-user@axis.apache.org
>> *主题:* 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
>> ">****
>>
>>                             <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 <bo...@gmail.com>****
>>
>> 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/****
>>
>
>
>
> --
> Shameera Rathnayaka
> Undergraduate
> Department of Computer Science and Engineering
> University of Moratuwa.
> Sri Lanka.
>
> Blog : http://shameerarathnayaka.blogspot.com/
>
>


-- 
Shameera Rathnayaka
Undergraduate
Department of Computer Science and Engineering
University of Moratuwa.
Sri Lanka.

Blog : http://shameerarathnayaka.blogspot.com/