【Android SOAP】基于第三方开源项目ksoap-android

项目地址:http://code.google.com/p/ksoap2-android/

 

服务器端,参考:【Web Service】Apache Tuscany发布Web Service

 

准备工作:

下载JAR文件

地址:http://ksoap2-android.googlecode.com/svn/m2-repo/com/google/code/ksoap2-android/ksoap2-android-assembly/3.0.0-RC.4/ksoap2-android-assembly-3.0.0-RC.4-jar-with-dependencies.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

 

 

转载于:https://www.cnblogs.com/dyingbleed/archive/2013/01/21/2866621.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值