0

My simple application didn't send any request to my simple web service

    package com.demo;
    import javax.jws.WebService;
    @WebService
    public class hello {

                         public String hai(String name)
                      {
                        return "Hello"+name;

                       }
                        }

and my android app code is

    public void onClick(View arg0) {
    // TODO Auto-generated method stub
    Toast.makeText(this, "success", Toast.LENGTH_LONG).show();
    try {
         SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME); 

         //parameters.addProperty("name","muthu");
          PropertyInfo username=new PropertyInfo();
          username.name="name";
          username.type=PropertyInfo.STRING_CLASS;
          request.addProperty(username,"welcome");




          SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
          envelope.setOutputSoapObject(request);                       
          HttpTransportSE androidHttpTransport = new HttpTransportSE(URL);            

          androidHttpTransport.call(SOAP_ACTION, envelope);

          SoapPrimitive  resultsRequestSOAP = (SoapPrimitive) envelope.getResponse();



     Toast.makeText(this, resultsRequestSOAP.toString(), Toast.LENGTH_LONG).show();
    }
    catch (Exception e) {}

    }

}

The web service is working fine when it returns values. I can receive a value without any problem. But my request show always null(or)empty when it return back to my android client side.

I am using ksoap:

ksoap2-android-assembly-2.5.7-jar-with-dependencies.jar

Server:

Glassfish 3.1 in eclipse

Please help me!!

4

1 回答 1

0

也许你可以看看这个Android 兼容的 Java Webservice 客户端代码生成器

于 2011-11-09T05:34:14.613 回答