0
我簡單的應用程序沒有發送任何請求給我簡單的Web服務KSOAP發送在Java Web服務空請求
package com.demo;
import javax.jws.WebService;
@WebService
public class hello {
public String hai(String name)
{
return "Hello"+name;
}
}
和我的Android應用程序代碼
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) {}
}
}
的Web服務在返回值時工作正常。我可以毫無問題地獲得價值。但是當我的請求返回到我的android客戶端時,我的請求總是顯示爲null(或)爲空。
我使用KSOAP:
ksoap2-android-assembly-2.5.7-jar-with-dependencies.jar
服務器:
Glassfish 3.1 in eclipse
請幫助我!