| | | 用.NET创建Web Service客户端 | | 2001-09-27·
·crytal编译··yesky
| 上一页 1 2 3 4 5 6 7 8 下一页 构建WAP客户端
传统的wap使用纯无限标记语言(wml)编写,.NET Mobile SDK 使我们能够利用象asp.NET控件那样的东西设计wap接口,这样做比写wml脚本快得多。
每一个.NET可移动页面的开始都要加上下面的语句
<%@ Page Inherits="System.Mobile.UI.MobilePage" Language="C#" %> <%@ Register TagPrefix="Mobile" Namespace="System.Mobile.UI" %> | 同样我们还是要访问livequotes.dll
| <%@ Import Namespace = "WebServiceClients" @%> | 下面是完整的代码
<%@ Page Inherits="System.Mobile.UI.MobilePage" Language="C#" %> <%@ Register TagPrefix="Mobile" Namespace="System.Mobile.UI" %> <%@ Import Namespace="WebServiceClients" %>
<script runat="server" language="c#">
protected void GetQuoteCommand_OnClick(Object sender, EventArgs e) {
LiveQuotes ProxyLiveQuotes = new LiveQuotes(); try { Code.Text = "Company Code - " + CompanyCode.Text; CompanyName.Text = "Name - " + ProxyLiveQuotes.MSNGetCompanyName(CompanyCode.Text); Price.Text = "Price - " + ProxyLiveQuotes.MSNGetLastQuote(CompanyCode.Text); } catch { Code.Text = "Company Code - " + CompanyCode.Text; CompanyName.Text = "Name - The company data is not available"; Price.Text = "Price - " + "0.0"; }
ActiveForm = SecondForm; }
</script>
<Mobile:Form runat="server"> <Mobile:Label runat="server">Enter the Company Code:</Mobile:Label> <Mobile:TextBox runat="server" id="CompanyCode" /> <Mobile:Command runat="server" OnClick="GetQuoteCommand_OnClick" Text="Get Quote" /> </Mobile:Form>
<Mobile:Form runat="server" id="SecondForm"> <Mobile:Label runat="server" id="Code" /> <Mobile:Label runat="server" id="CompanyName" /> <Mobile:Label runat="server" id="Price" /> </Mobile:Form> | 微软 .NET Mobile Web SDK 具有将IE 作为WAP客户端的能力,这将加速开发过程。我使用IE5.5模拟下面的WAP功能。
 |
在点击Get Quote按钮后,将得到下面的页面
 |
对所有的怀疑者而言,下面是一个熟悉的页面
 |
我们已经讨论了构建Web Service的基础,我们通过PDA和SOAP客户端打开了通往Web Service的道路。
结束语
本文集中讨论了微软的web服务,微软不是这个市场的唯一玩家,ibm和sun也都在为抢占市场份额拼命努力,下面ibm和sun 关于Web Service的站点
IBM -- HTTP://www-106.ibm.com/developerworks/webservices/
Sun -- HTTP://www.sun.com/software/sunone/portfolio/aws.html
研究Web Service时非常有兴趣的一件事,这个慨念已经叫嚷很久了,主要厂商都宣布支持Web Service, 但是时间将告诉我们,我们究竟能从这项技术获得些什么。
上一页 1 2 3 4 5 6 7 8 下一页 | | | 感谢
访问天极网,如果您觉得该文章涉及版权问题,请看这里!
|
|