Android开发之查询QQ是否在线


这个小程序的主要原理是通过HTTP协议发送XML数据并调用webservice

Web Service(WEB服务)能够快捷和方便地综合并结合各种系统、商务和任何应用平台。新出现的 Web Services 标准: SOAP、WSDL 和 UDDI 能够使任何系统和系统之间的应用变为更加方便和廉价。

Web服务(Web Services)和Service—Oriented Architecture作为实现分布式系统和履行公司内部、公司之间的应用整合的技术和架构出现。SOA和Web服务的体系结构是两个不同层面的问题,前者是概念模式,面向商业应用;后者则是实现模式,面向技术框架。

面向服务的体系结构所表示的是一个概念上的模型,在这个模型中,松散耦合的应用在网络上被描述、发布和调用。而Web服务则是一组由协议构成的协议栈所定义的框架结构,它定义了在不同的系统之间通信松散耦合的编程框架。也可以认为,Web服务体系结构实际上是面向服务的体系结构的一个特定实现;面向服务的体系结构作为一个概念上的模型,将网络、传输协议以及安全等具体的细节都遗留给特定的实现。Web服务中的SOAP,WSDL等都是具体实现细节的标准。

首先写出布局

  1. <?xml version="1.0"encoding="utf-8"?>  
  2.   
  3. <LinearLayout xmlns:Android="http://schemas.android.com/apk/res/android"  
  4.   
  5.     android:layout_width="fill_parent"  
  6.   
  7.     android:layout_height="fill_parent"  
  8.   
  9.     android:orientation="vertical" >  
  10.   
  11.    
  12.   
  13.    <TextView  
  14.   
  15.         android:layout_width="fill_parent"  
  16.   
  17.         android:layout_height="wrap_content"  
  18.   
  19.         android:text="@string/qq" />  
  20.   
  21.    
  22.   
  23.    <EditText  
  24.   
  25.         android:id="@+id/qqID"  
  26.   
  27.         android:layout_width="fill_parent"  
  28.   
  29.         android:layout_height="wrap_content"  
  30.   
  31.         android:text="296463139" />  
  32.   
  33.    
  34.   
  35.    <Button  
  36.   
  37.         android:id="@+id/buttonID"  
  38.   
  39.         android:layout_width="wrap_content"  
  40.   
  41.         android:layout_height="wrap_content"  
  42.   
  43.         android:text="@string/button" />  
  44.   
  45.    
  46.   
  47.    <TextView  
  48.   
  49.         android:id="@+id/resultID"  
  50.   
  51.         android:layout_width="fill_parent"  
  52.   
  53.         android:layout_height="wrap_content" />  
  54.   
  55.    
  56.   
  57. </LinearLayout>  

然后建立web服务的xml

qqstatus.xml

  1. <?xml version="1.0" encoding="utf-8"?>  
  2. <soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">  
  3.   <soap12:Body>  
  4.     <qqCheckOnline xmlns="http://WebXml.com.cn/">  
  5.       <qqCode>$qq</qqCode>  
  6.     </qqCheckOnline>  
  7.   </soap12:Body>  
  8. </soap12:Envelope>  
  • 1
  • 2
  • 下一页

相关内容