Building_a_Simple_Web_Service【DOC精选】.docVIP

  • 2
  • 0
  • 约5.01千字
  • 约 12页
  • 2017-02-16 发布于江苏
  • 举报
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

文档评论(0)

1亿VIP精品文档

相关文档