<WebMethod()> Public Function FahrenheitToCelsius
(ByVal Fahrenheit As Int16) As Int16
Dim celsius As Int16
celsius = ((((Fahrenheit) - 32) / 9) * 5)
Return celsius
End Function
<WebMethod()> Public Function CelsiusToFahrenheit
(ByVal Celsius As Int16) As Int16
Dim fahrenheit As Int16
fahrenheit = ((((Celsius) * 9) / 5) + 32)
Return fahrenheit
End Function
End Class
This document is the .asmx file. This is an ASP.NET file extension for the XML Web Services.
To run the above example you will need .NET server.
The first line in the document that it is the Web Service, written in the VB and the
class name is a "TempConvert":
Next lines imports a namespace "System.Web.Services" from a .NET framework.
Imports System
Imports System.Web.Services
The next line defines that "TempConvert" class is the WebSerivce class type:
Public Class TempConvert :Inherits WebService
Next step is the basic VB programming. This application do have two functions. One to
convert from the Fahrenheit to Celsius, and the other one to convert from Celsius to
Fahrenheit.
The only difference from the normal application is, this function is been defined as
the "WebMethod".
Use "WebMethod" to mark the functions in the application that you would like
to make into an web services.
<WebMethod()> Public Function FahrenheitToCelsius
(ByVal Fahrenheit As Int16) As Int16
Dim celsius As Int16
celsius = ((((Fahrenheit) - 32) / 9) * 5)
Return celsius
End Function
<WebMethod()>Public Function CelsiusToFahrenheit
(ByVal Celsius As Int16) As Int16
Dim fahrenheit As Int16
fahrenheit = ((((Celsius) * 9) / 5) + 32)
Return fahrenheit
End Function
Last thing to do is, end the function and the class:
End Function
End Class
If you save this as the .asmx file and publish it on the server with a .NET support,
you should have the first working Web Service. Like our example Web Service
No Web Services Articles could be found as of now.
Share And Enjoy:These icons link to social bookmarking sites where readers can share and discover new web pages.
Keywords: web services framework, web services applications, web services programming,
web services implementation, web services soap, web services tomcat, web services xml,
web services interface, web services specification, web services performance,
web services php, web services apache, web services documentation, web services ejb,
web services oracle, web services samples, web services application, web services code,
web services ibm, web services wsdl, web services wsad, web services project,
web services client, web service tutorial, web services development, web services developers,
web services session, using examples, web service sample, sample examples,
web service code, web service tutorials, web services developer, web service samples,
code examples