connectWebService()方法:
//使用 ksoap2 调用webservice private boolean connectWebService(String methodName,String fileName, String imageBuffer) { String namespace = "http://134.192.44.105:8080/SSH2/service/IService"; // 命名空间,即服务器端得接口,注:后缀没加 .wsdl, //服务器端我是用x-fire实现webservice接口的 String url = "http://134.192.44.105:8080/SSH2/service/IService"; //对应的url //以下就是 调用过程了,不明白的话 请看相关webservice文档 SoapObject soapObject = new SoapObject(namespace, methodName); soapObject.addProperty("filename", fileName); //参数1 图片名 soapObject.addProperty("image", imageBuffer); //参数2 图片字符串 SoapSerializationEnvelope envelope = new SoapSerializationEnvelope( SoapEnvelope.VER10); envelope.dotNet = false; envelope.setOutputSoapObject(soapObject); HttpTransportSE httpTranstation = new HttpTransportSE(url); try { httpTranstation.call(namespace, envelope); Object result = envelope.getResponse(); Log.i("connectWebService", result.toString()); } catch (Exception e) { e.printStackTrace(); } return false; }Android之调用webservice 实现图片上传下载(2)
内容版权声明:除非注明,否则皆为本站原创文章。