歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux編程 >> Linux編程 >> Android開發之查詢QQ是否在線

Android開發之查詢QQ是否在線

日期:2017/3/1 10:45:19   编辑:Linux編程

這個小程序的主要原理是通過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. <LinearLayout xmlns:Android="http://schemas.android.com/apk/res/android"
  3. android:layout_width="fill_parent"
  4. android:layout_height="fill_parent"
  5. android:orientation="vertical" >
  6. <TextView
  7. android:layout_width="fill_parent"
  8. android:layout_height="wrap_content"
  9. android:text="@string/qq" />
  10. <EditText
  11. android:id="@+id/qqID"
  12. android:layout_width="fill_parent"
  13. android:layout_height="wrap_content"
  14. android:text="296463139" />
  15. <Button
  16. android:id="@+id/buttonID"
  17. android:layout_width="wrap_content"
  18. android:layout_height="wrap_content"
  19. android:text="@string/button" />
  20. <TextView
  21. android:id="@+id/resultID"
  22. android:layout_width="fill_parent"
  23. android:layout_height="wrap_content" />
  24. </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>
Copyright © Linux教程網 All Rights Reserved