https://simpligility.github.io/ksoap2-android/index.html
https://oss.sonatype.org/content/repositories/ksoap2-android-releases/
com>google>code>ksoap2-android>ksoap2-android-assembly
https://oss.sonatype.org/content/repositories/ksoap2-android-releases/com/google/code/ksoap2-android/ksoap2-android-assembly/3.6.4/ksoap2-android-assembly-3.6.4-jar-with-dependencies.jar
private final String serviceNameSapce = "http://192.168.20.135:8090/"; private final String serviceUrl = "http://192.168.20.135:8090/TestService.asmx"; private final String serviceMethod = "HelloWorld"; private final String serviceAction = "http://192.168.20.135:8090/HelloWorld"; private String strResult = "";
new Thread(new Runnable() { @Override public void run() { //创建HttpTransportSE传输对象,serviceUrl是webservice提供服务的url HttpTransportSE httpTransportSE = new HttpTransportSE(serviceUrl); //使用SOAP1.1协议创建Envelop对象,根据服务端WebService的版本号设置SOAP协议的版本号 SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); //实例化SoapObject对象,第一个参数表示命名空间,第二个参数表示要调用的WebService方法名 SoapObject soapObject= new SoapObject(serviceNameSapce, serviceMethod); //设置调用方法的参数值,如果没有参数,可以省略 //soapObject.addProperty("theCityCode", cityName); envelope.bodyOut = soapObject; envelope.dotNet = true; try { //调用webservice httpTransportSE.call(serviceAction, envelope); //获取服务器响应返回的SOAP消息 if(envelope.getResponse() != null){ SoapObject resultSoap = (SoapObject)envelope.bodyIn; strResult = resultSoap.getProperty(0).toString(); mHandler.sendEmptyMessage(0x002); } } catch (IOException | XmlPullParserException e) { e.printStackTrace(); } } }).start();