windows mobile行動裝置 App程式與webservice之間的資料互動

來源:互聯網
上載者:User
文章目錄
  • 本篇簡要說明
本篇簡要說明

windows mobile上的應用程式除了可以與本地的SQL Server CE進行資料互動,還可以與遠端webservice通訊,這個過程基本類似於winform的開發,我們可以先建立一個解決方案,包括一個windows mobile的應用程式項目和一個web網站,其中web網站內只需要添加一個webservice服務頁面即可,這裡按預設的頁面,這個服務內部只有一個預設方法Helloworld,當windows mobile應用程式調用此方法時,可以接收到hello,world!

步驟一 建立webservice及windows mobile 應用程式

werservice內只有一個簡單方法helloworld();

步驟二 在windows mobile應用程式中添加web引用,引用名預設

添加引用後,在預設的Form1上添加一個按鈕,用來觸發webservice事件,可以在按鈕的點擊事件添加如下調用代碼:

private void button1_Click(object sender, EventArgs e)
        {
            localhost.Service ws = new SmartDeviceProject1.localhost.Service();
            MessageBox.Show("Message From webservice: "+ws.HelloWorld());
        }

這樣即可測試了,但是這裡有一個問題,就是在搜尋資料時發現webcast中的代碼,webservice的地址不是:

http://localhost:4534/WebSite2/WebService.asmx

 

就是說這個webservice地址的採用的是PC的名稱,不是localhost,而應該填寫原生內網ip:連接埠號碼,比如http://192.168.1.6:3900//路徑.....。

 相關源碼:本機windows mobile下windows mobile+webservice-1和windows mobile+webservice-2

原文連結:http://www.cnblogs.com/wengyuli/archive/2010/04/17/windows-mobile-webservice.html

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.