Cook Computing

XML-RPC.NET Service in VB.NET

October 7, 2002 Written by Charles Cook

Charles Nadeau recently asked (on the XMLRPCNET group) for an example of an XML-RPC.NET service written in VB.NET. I'm doing some work on the XML-RPC.NET FAQ this evening and added the following sample code:


Imports CookComputing.XmlRpc

Public Structure SumAndDiffValue
   Public sum As Integer
   Public difference As Integer
End Structure

Public Class SumAndDiffService
   Inherits XmlRpcService

 <XmlRpcMethod("samples.sumAndDifference")> _
 Public Function SumAndDifference(ByVal x As Integer, _
                                  ByVal y As Integer) _
                                  As SumAndDiffValue
   Dim ret As SumAndDiffValue
   ret.difference = x - y
   ret.sum = x + y
   Return ret
 End Function
End Class