MathService Example

Listing 2. The MathService has the ScriptServiceAttribute class applied to it and exposes a single method named Add(). The service is located in the XmlForAsp namespace.

Namespace XmlForAsp
  <ScriptService()> _
  <WebService(Namespace:="http://xmlforasp.net/MathService")> _
  <WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)> _
  Public Class MathService
    Inherits System.Web.Services.WebService

    <WebMethod()> _
    Public Function Add(ByVal x As Integer, ByVal y As Integer) _
     As Integer
      Return x + y
    End Function

  End Class
End Namespace