Microsoft ®.NET TM 程式開發菁英研習營
5 Steps 輕鬆快速開發跨 Internet 及異質平台 AP-to- AP 整合的 Web Service 技術副總 Microsoft RD 微軟技術代言人 Miles Sun 孫三才 恆逸資訊股份有限公司
Microsoft ®.NET TM 程式開發菁英研習營 議程目標 背景 Microsoft®.NET Framework Microsoft ASP.NET Web Services 總覽 觀念與架構 設計與開發 Web Services 引用 (Consume) Web Services
Microsoft ®.NET TM 程式開發菁英研習營 議程 Microsoft.NET 的願景 Web Service 運作架構 5 Steps 輕鬆快速開發新一代 Web Service 服務 第一步 : 以 ASP.NET 撰寫 Web Service 第二步 : Web Service 部署 第三步 : Web Service 測試 第四步 : 存取 Web Service 第五步 : 撰寫 Web Service Consumer HailStorm Service 介紹
Microsoft.NET 的願景 第一代 Internet
Microsoft.NET 的願景 第二代 Internet
Microsoft.NET 的願景 下一代 Internet
Microsoft ®.NET TM 程式開發菁英研習營 Microsoft.NET 的願景 Microsoft.NET 的願景 分散式運算與元件 傳統的分散式運算 Client/server model Distributed object model) 分散式物件模式 ( Distributed object model) Components: packaging and interoperability Remoting: remote method invocation COM, CORBA, Java RMI and EJB Microsoft Windows DNA Distributed interNet Application Architecture DHTML, COM, ASP, Message Queuing The interactive Web
Web Service 運作架構.NET 平台
Web Service 運作架構 SOAP Protocol
Microsoft ®.NET TM 程式開發菁英研習營 5 Steps 輕鬆快速開發 Web Service.NET Framework 與 ASP.NET Microsoft.NET Framework System Services Common Language Runtime ASP.NET Web FormsWeb Services Windows Forms Services Framework BaseDataDebug...
Microsoft ®.NET TM 程式開發菁英研習營 5 Steps 輕鬆快速開發 Web Service Web Service 運作模式 Web Service Client Discovery Request disco Return disco (XML) Description Request WSDL Return WSDL (XML) Protocol Request.asmx Return response (XML)
Microsoft ®.NET TM 程式開發菁英研習營 5 Steps 輕鬆快速開發 Web Service 第一步 : 以 ASP.NET 撰寫 Web Service 產生一個.asmx 檔案 檔頭加入宣告 : using System.Web.Services; Optional: using 其他名稱空間 定義 public class DataService Mark all “Web Callable” Method [WebMethod]
Microsoft ®.NET TM 程式開發菁英研習營 5 Steps 輕鬆快速開發 Web Service 第一步 : 範例 using System; using System.Data; using System.Data.SQL; using System.Web.Services; public class DataService { [WebMethod] [WebMethod] public DataSet GetForum() { public DataSet GetForum() { SQLConnection myConnection = new SQLConnection(“server=localhost;uid=sa;pwd=;database=book_14"); SQLConnection myConnection = new SQLConnection(“server=localhost;uid=sa;pwd=;database=book_14"); SQLDataSetCommand myCommand1 = new SQLDataSetCommand("select * from forum_subject", myConnection); SQLDataSetCommand myCommand1 = new SQLDataSetCommand("select * from forum_subject", myConnection); SQLDataSetCommand myCommand2 = new SQLDataSetCommand("select * from forum", myConnection); SQLDataSetCommand myCommand2 = new SQLDataSetCommand("select * from forum", myConnection); DataSet ds = new DataSet(); DataSet ds = new DataSet(); myCommand1.FillDataSet(ds, "forum_subject"); myCommand1.FillDataSet(ds, "forum_subject"); myCommand2.FillDataSet(ds, "forum"); myCommand2.FillDataSet(ds, "forum"); return ds; return ds; }
Microsoft ®.NET TM 程式開發菁英研習營 5 Steps 輕鬆快速開發 Web Service 第二步 : Web Service 部署 Create new Web Site 或 Virtual Directory 將.ASMX 檔 Copy 過去
Microsoft ®.NET TM 程式開發菁英研習營 5 Steps 輕鬆快速開發 Web Service 第三步 : Web Service 測試 用 IE, 連結至新部署的.ASMX 檔 逐一測試 “WebMethod” 檢視 SDL – Service Description Language
Microsoft ®.NET TM 程式開發菁英研習營 5 Steps 輕鬆快速開發 Web Service 第四步 : 存取 Web Service WebServiceUtil.exe 工具程式 webserviceutil /c:proxy /pa: Service.asmx?SDL /l:CSharp /n:UCOM csc /out:UDataServiceProxy.dll /t:library /r:System.Xml.Serialization.dll /r:System.Web.Services.dll /r:system.data.dll dataservice.cs 或 Visual Studio.NET Add Web Reference …
Microsoft ®.NET TM 程式開發菁英研習營 5 Steps 輕鬆快速開發 Web Service 第五步 : 撰寫 Web Service Consumer Add Reference to Proxy New Web Service Class mDataService= new DataService(); Optional: 指定 Web Service URL mDataService.Url= … Call Web Service Function mDS=mDataService.GetForum() ;
Microsoft ®.NET TM 程式開發菁英研習營 HailStorm Service 介紹 myAddress - electronic and geographic address for an identity myAddress - electronic and geographic address for an identity myProfile - name, nickname, special dates, picture … myProfile - name, nickname, special dates, picture … myContacts – electronic relationships/address book myContacts – electronic relationships/address book myLocation - electronic and geographical location and rendez-vous myNotifications – notification subscription, management and routing myLocation - electronic and geographical location and rendez-vous myNotifications – notification subscription, management and routing myInbox - inbox items like and voice mail, including existing mail systems myInbox - inbox items like and voice mail, including existing mail systems myCalendar – time and task management myCalendar – time and task management myDocuments – raw document storage myApplicationSettings - application settings myDocuments – raw document storage myApplicationSettings - application settings
Microsoft ®.NET TM 程式開發菁英研習營 HailStorm Service 介紹 myFavoriteWebSites – favorite URLs and other Web identifiers myFavoriteWebSites – favorite URLs and other Web identifiers myWallet - receipts, payment instruments, coupons and other transaction records myWallet - receipts, payment instruments, coupons and other transaction records myDevices – device settings, capabilities myDevices – device settings, capabilities myServices – services provided for an identity myServices – services provided for an identity myUsage – usage report for above services myUsage – usage report for above services
Microsoft ®.NET TM 程式開發菁英研習營 問題與討論