.NET Remoting Example

In fact, an example now is actually in order. Several examples are available within the .NET Framework SDK, and some are more complex than others. For this example, you'll stick with something rather simple: You'll access a remote object that will give you the server's local time.

To begin, fire up Visual Studio .NET and create a new class library. We did this for Visual Basic .NET; we've shown the code that we inserted into the class library in Listing 8.1.

Listing 8.1. The RemoteTimeServer Implementation
Imports System

Public Class RemoteTime
   Inherits MarshalByRefObject

   Public Function GetServerTime() As String
      ' Simply return the current time
      GetServerTime = DateTime.Now.ToString()
   End Function

End Class

Here you ...

Get Applied SOAP: Implementing .NET XML Web Services now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.