android程序调用asmx页面

1导入ksoap2-android-assembly-2.4-jar-with-dependencies.jar
2加入上网权限:
3导入包

import org.ksoap2.SoapEnvelope;
import org.ksoap2.serialization.SoapObject;
import org.ksoap2.serialization.SoapSerializationEnvelope;
import org.ksoap2.transport.HttpTransportSE;

 


4代码
     

   String nameSpace = http://tempuri.org/;
        String serviceURL = "http://192.168.10.3:98/TestClothingDRPService/ServicePowerEAI.asmx";
        String methodName = "GetHelpFileURL";//方法名
        String soapAction = "http://tempuri.org/GetHelpFileURL";
        SoapObject request = new SoapObject(nameSpace, methodName);
       
        request.addProperty("HCC", "19");
      
       
        SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
        envelope.bodyOut = request;
        envelope.dotNet=true;
        HttpTransportSE ht = new HttpTransportSE(serviceURL);
        ht.debug = true;
        String result="";
        try {
            ht.call(soapAction, envelope);
            if (envelope.getResponse() != null) {
             result= envelope.getResponse().toString();
            } else {
           
            }
        } catch (Exception e) {
            e.printStackTrace();
         
        }
        TextView tv1=(TextView)findViewById(R.id.textView1);
        tv1.setText(result);

 


<script type="text/javascript"> </script><script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值