- 1、本文档共12页,可阅读全部内容。
- 2、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
- 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
Building_a_Simple_Web_Service【DOC精选】
21/11/2007 Building a Simple Web Service
Distributed Enterprise Applications Stephen Hole
Simple Web Service
Distributed Enterprise Applications
Introduction
This tutorial is meant to illustrate the ease with which a Web Service can be constructed.
Creating the Service
Create a new Visual Studio 2005 Web Site named MoneyConverter. The service needs to provide functions for the following:
Converting Dollars To Euros
Converting Euros To Dollars
The new project should use the:
ASP.NET Web Service Template
HTTP as location (http://localhost/MoneyConverter)
Visual Basic as the language
When the ASP.NET Web Service template open the Solution Explorer should look similar to Figure 2.
The default code created is shown below.
Please note that there is a Hello World WebMethod created as a template for guidance on how to create programmer defined WebMethods.
Imports System.Web
Imports System.Web.Services
Imports System.Web.Services.Protocols
WebService(Namespace:=/) _
WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1) _
Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated() _
Public Class Service
Inherits System.Web.Services.WebService
WebMethod() _
Public Function HelloWorld() As String
Return Hello World
End Function
End Class
In the Solution Explorer rename Service.asmx to MoneyConverter.asmx.
In the Code Window rename the Class from Service to MoneyConverter.
Change the tag code in MoneyConverter.asmx to reflect the change in class name.
Default MoneyConverter.asmx code %@ WebService Language=vb CodeBehind=~/App_Code/Service.vb Class=Service % MoneyConverter.asmx code after change in class name %@ WebService Language=vb CodeBehind=~/App_Code/Service.vb Class=MoneyConverter %
You can test the Web Service by running your project. This is ok if you want a simple test but you will need to run without debugging.
When the service runs it will open up in the default web browser.
Click HelloW
您可能关注的文档
- book、reader和borrow表练习题【DOC精选】.doc
- Book_Unit__healthy_eating_导学案教师版【DOC精选】.doc
- BookZ Text Reader图书上传教程【DOC精选】.doc
- Boolean数据类型 真假【DOC精选】.doc
- boolean的使用方法【DOC精选】.doc
- bootstrap-frame【DOC精选】.doc
- bootstrap_table_document【DOC精选】.docx
- Boosting by weighting critical and erroneous samples【DOC精选】.doc
- bootstrap中CSS的学习【DOC精选】.docx
- bootstrap学习文档【DOC精选】.doc
文档评论(0)