项目地址:http://code.google.com/p/ksoap2-android/
服务器端,参考:【Web Service】Apache Tuscany发布Web Service
准备工作:
下载JAR文件
添加至项目Build Path
示例:
try { SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME); request.addProperty("arg0", mName); SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); envelope.setOutputSoapObject(request); HttpTransportSE transport = new HttpTransportSE(URL); transport.call(SOAP_ACTION, envelope); SoapObject response = (SoapObject) envelope.bodyIn; String returnString = response.getPropertyAsString("return"); if (returnString == null) { //TODO: } else { //TODO: } } catch (Exception e) { e.printStackTrace(); //TODO: }
参考:http://code.google.com/p/ksoap2-android/wiki/CodingTipsAndTricks