Log on:
Powered by Elgg

Cuong Nguyen :: Blog :: A simple web service

June 02, 2007

A simple web service
  • Currently /5

Avg rating: - - based on 0 ratings

5 Stars 0
4 Stars 0
3 Stars 0
2 Stars 0
1 Star 0
   * Includes your rating
--(Log in to rate this blog post!)--

If you want to write/view a simple web service for fun. You can cut and paste the code from the below URL and add to your asp application or run it from the URL to see how the web service work.

http://samples.gotdotnet.com/quickstart/aspplus/doc/writingservices.aspx

Here is the code in VB for a Math service

<%@ WebService Xlanguage="VB" Class="MathService" %>  Imports System Imports System.Web.Services  Public Class MathService : Inherits WebService     <WebMethod()> Public Function Add(A As System.Single, B As System.Single) As System.Single         Return A + B    End Function     <WebMethod()> Public Function Subtract(A As System.Single, B As System.Single) As System.Single         Return A - B    End Function     <WebMethod()> Public Function Multiply(A As System.Single, B As System.Single) As System.Single         Return A * B    End Function     <WebMethod()> Public Function Divide(A As System.Single, B As System.Single) As System.Single         If B = 0           Return -1        End If        Return Convert.ToSingle(A / B)    End Function  End Class 

Posted by Cuong Nguyen

You must be logged in to post a comment.