ASPnews Home

News

Analysis

Trends

Strategies

ASP Directory

Community

About Us

Search ASPnews:



internet.com
Developer
Downloads
International
Internet Lists
Internet News
Internet Resources
IT
Linux/Open Source
Personal Technology
Small Business
Windows Technology
xSP Resources
Search internet.com
Advertise
Corporate Info
Newsletters
Tech Jobs
E-mail Offers
internet.commerce
Be a Commerce Partner
Cheap Plane Tickets
Digital Camera Review
Register Domain Name
Memory Flash Cards
Online Education
Batteries
T-Shirts
Remote Access
Advertising Trucks
Online Degrees
Best Digital Camera
Cheap Web Hosting
Digital Camera Review



ASPnews Focus
Top News:
» SOAs So Close, Yet So Far

» Why SaaS Is Making a Comeback

» Join the Discussion: ASPnews.com's industry forums

Plus:
» More ASP News

TOP 50
Top 20 Providers
 & Top 30 Enablers
Free Newsletter!



ASPnews Shortcuts
Week's Top News

ASP News at internetnews.com

Industry Events

Discussion Forums

Industry Basics

Site Guide

Learn how UML Modeling, Collaboration, and Profiling Make Sun Java Studio Enterprise 7 Unique

STRATEGIES
 


Dev: Building Distributed Apps? Use XML Web Services, Not .NET Remoting (Mostly)
By Paul Kimmel

December 16, 2004

Continued from Page 1

Producing a Web Service in VB.NET

Due in no small part to the .NET Framework, creating a Web service is no harder than creating a console application. From your perspective, you are just creating a project and adding some methods. Specific attributes defined by the .NET framework take care of adding all of the extra details you need to convert your ordinary class and assemble it into a Web service. Interestingly enough, Visual Studio .NET’s project templates even take care of adding the attributes necessary to distinguish regular classes and methods from Web service classes and Web methods.

To create a plain vanilla Web service, take the following steps:

  1. Open Visual Studio .NET.
  2. Select File|New|Project.
  3. From the New Project dialog box, select the ASP.NET Web service template and click OK.

The IDTExtensibility2 interface supports VS.NET wizards. When you open an existing project template, a pre-defined wizard reads text files that were added to your file system when you installed VS.NET. These text files contain replaceable parameters, which are filled in to create project elements such as configuration files and source code files with attributes for XML Web services.

The previously defined steps employ these template files and wizard to create a Web service project. If you uncomment the four lines of code included in the project template, you already have a complete Web service, albeit a do-nothing Hello World-style Web service.

Uncomment the code shown in Listing 1 and select Debug|Start to run the Web service. For now, ignore all of the code except what is in boldface near the end of the listing.

Listing 1: The basic sample Web service included with VS.NET’s template Web service is our friend HelloWorld.

Imports System.Web.Services
<System.Web.Services.WebService(Namespace := _
       "http://tempuri.org/WebService1/Service1")> _
Public Class Service1
    Inherits System.Web.Services.WebService
#Region " Web services Designer Generated Code "
    Public Sub New()
        MyBase.New()
        'This call is required by the Web services Designer.
        InitializeComponent()
        'Add your own initialization code after the
        'InitializeComponent() call
    End Sub
    'Required by the Web services Designer
    Private components As System.ComponentModel.IContainer
    'NOTE: The following procedure is required by the Web
    'services Designer
    'It can be modified using the Web services Designer.
    'Do not modify it using the code editor.
    <System.Diagnostics.DebuggerStepThrough()>
        Private Sub InitializeComponent()
        components = New System.ComponentModel.Container()
    End Sub
    Protected Overloads Overrides Sub Dispose(ByVal disposing _
                                              As Boolean)
        'CODEGEN: This procedure is required by the Web services
        'Designer
        'Do not modify it using the code editor.
        If disposing Then
            If Not (components Is Nothing) Then
                components.Dispose()
            End If
        End If
        MyBase.Dispose(disposing)
    End Sub
#End Region
    ' WEB SERVICE EXAMPLE
    ' The HelloWorld() example service returns the string Hello
    ' World.
    ' To build, uncomment the following lines; then save and build
    ' the project.
    ' To test this Web service, ensure that the .asmx file is the
    ' start page and press F5.
    '
    <WebMethod()> _
    Public Function HelloWorld() As String
       Return "Hello World"
    End Function
End Class

Page 3: Running a Web Service

Go to page: Prev  1  2  3  4  5  Next  

Email this Article
View Printable Version
Back to Strategies

 

Featured Links
Learn the secrets of the popular search engines!
Free Web Hosting Buyer's Guide -- Click Here!
Enhance your Web site with the Dynamic HTML HierMenus Code


JupiterWeb networks:

internet.comearthweb.comDevx.comGraphics.com

Search JupiterWeb:

Jupitermedia Corporation has three divisions:
Jupiterimages, JupiterWeb and JupiterResearch

Copyright 2005 Jupitermedia Corporation All Rights Reserved.
Legal Notices, Licensing, Reprints, & Permissions, Privacy Policy.

Jupitermedia Corporate Info | Newsletters | Tech Jobs | Shopping | E-mail Offers


Give us your Feedback