Create a new ASP.NET Web Service project
Visual Studio will automatically create a subdirectory under the IIS'd main directory and names it after your project.
Just like a web application is contains its own web.config and global.asax files.
It also includes the following file:


This file contains the code of your XML web service that is accessed through the Internet via HTTP.
You should give this file a more descriptive name relating the project you are creating.
This file will be accessed programmatically.
An XML web service does not have a user interface.

WebService Attribute

This qualifies the class as an XML web service class.

<WebService(Namespace:="")> _ 
<WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)> _
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Public Class BetterService
   Inherits System.Web.Services.WebService

This attribute is not really required since the .asmx file extension and the fact that the class inherits from System.Web.Services.WebService is enough.
However this attribute for passing additional information about the web service such as its description and namespace so you should always include it.

WebMethod Attribute

This qualifies a method of the class to be accessible through the Internet.
Only methods marked with this attribute are visible from remote clients.
You can use this attribute to assciate a decription with your method as well as other important properties.

<WebMethod(Description:="Register a new user")> 
Public Function RegisterUser(ByVal sFirstName As String) As Boolean

End Function

© 2024 Better Solutions Limited. All Rights Reserved. © 2024 Better Solutions Limited TopPrevNext