Android Ksoap wcf

 // 命名空间
 String serviceNameSpace = "http://tempuri.org/";

 String methodName = "GetAllPersons";
 // 请求URL
String serviceURL = "http://10.0.3.2:65458/WCFService2/Service.svc";
 //private static final String serviceURL = "http://10.14.4.67:3009/ITHmeApp/ITHomeService.asmx";
 // SoapAction
  String soapAction = "http://tempuri.org/IPersonService/GetAllPersons";
 //private static final String soapAction = "http://tempuri.org/ReceviceCommand";


 // 指定WebService的命名空间和调用的方法名
 SoapObject request = new SoapObject(serviceNameSpace, methodName);
 // example方法中有一个String的参数,这里将“android client”传递到example request.addProperty("i", "oh");
 request.addProperty("a","a1");
 request.addProperty("b1","b1");
 // 获得序列化的Envelope
 SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(
         SoapEnvelope.VER11);
 envelope.dotNet = true;
 envelope.bodyOut = request;

 // Android传输对象
 HttpTransportSE transport = new HttpTransportSE(serviceURL);
 transport.debug = true;

 // 调用WebService
 try {
     transport.call(soapAction, envelope);
 } catch (IOException e) {
     Log.d("KSOAP", e.toString());
 } catch (XmlPullParserException e) {
     Log.d("KSOAP", e.getMessage());
 }
 try {
     if (envelope.getResponse() != null) {
         Log.d("KSOAP", "go3: "+envelope.getResponse().toString()+envelope.toString());
     }
 } catch (SoapFault e) {
     Log.d("KSOAP", "error");
 }
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值