您现在的位置是: 软件 > 开发者网络 > 技术跟踪 > XML与.NET专栏 > 正文


-Win xp中的多种网络
-试验试验试验试验
-用Freehand实现位图矢量化
-网络电话面面观

用.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  下一页

【责任编辑:方舟】
【发表评论】【关闭窗口】
■ 相关内容
 利用.NET Framework创建基于Windows的应用程序
 审核Web Service
 通过Web Services提供内容服务
 开发基于接口的.NET Web服务
 利用ASP.NET来访问Excel文档
 .NET企业服务器如何在.NET平台上大显身手
 .NET对IT专业人员的重要意义
 用ASP.NET 做自己的邮件发送系统
 怎样创建.NET Web Service
 XML、Web服务和.NET框架
 Microsoft .NET让新一代因特网变成现实
感谢 访问天极网,如果您觉得该文章涉及版权问题,请看这里!