码迷,mamicode.com
首页 > 移动开发 > 详细

android调用webservice方法

时间:2014-11-07 16:40:18      阅读:222      评论:0      收藏:0      [点我收藏+]

标签:android   blog   http   io   os   java   sp   数据   div   

String NAMESPACE="http://WebXml.com.cn/";
String METHOD_NAME="getMobileCodeInfo";
	
String URL = "http://webservice.webxml.com.cn/WebServices/MobileCodeWS.asmx";
String SOAP_ACTION = "http://WebXml.com.cn/getMobileCodeInfo";

SoapObject rpc = new SoapObject(NAMESPACE, METHOD_NAME);
rpc.addProperty("mobileCode",phoneSec);
rpc.addProperty("userId","");
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
		envelope.bodyOut = rpc;
		envelope.dotNet = true;
		envelope.setOutputSoapObject(rpc);
		
		HttpTransportSE ht = new HttpTransportSE(URL); 
		ht.debug = true;
		ht.call(SOAP_ACTION, envelope);
		
		 // 获取返回的数据  
        SoapObject object = (SoapObject) envelope.bodyIn;  
        // 获取返回的结果  
        String result = object.getProperty(0).toString();  
        
        t1.setText(result); 

  

android调用webservice方法

标签:android   blog   http   io   os   java   sp   数据   div   

原文地址:http://www.cnblogs.com/youyuan1980/p/4081515.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!