Using SOAP for Remoting

SOAP is a popular XML protocol for transferring data on the Internet, and you can also use it in .NET for remoting objects. To do that, you use the System.Runtime.Serialization.Formatters.Soap namespace. We'll create the server and client we've been using in this chapter again using SOAP messaging now.

Creating the Server

In the server, we create a new object of our Capitalizer class to remote, and get a reference to that object with the RemotingServices class's Marshal method. Then we create a file named soap.txt, which will hold the SOAP message read by the client and use it to connect to the server, and use a SoapFormatter object to serialize our object reference to the file soap.txt:

 public static void Main() { HttpChannel ...

Get Microsoft® Visual C#® .NET 2003 Kick Start 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.