.NET Remoting and Web Services — Which to Use? - ' What Are These Things' (
Page 2 of 3 )
?">
It's more and more common for applications to be distributed. While the user sits at a single computer, the behind-the-scenes action takes place on two or more computers, separated by only a few dozen feet or located on different continents. One of the major innovations of the .Net platform was to simplify the programming of distributed applications. The .Net developer has a variety of choices at his or her fingertips. You need to understand some of the technical details to make the best choice for your specific project.
Of course some apps are "distributed" by default. Any ASP application, whether ASP classic or ASP.NET, runs on both the client and on the Web server. Likewise, a multi-user database is always distributed — SQL Server running here, clients running in various locations. These are important technologies, to be sure, but it's not what I am talking about. Rather, I am referring to two .Net tools that provide great flexibility in allowing applications on one computer to interact with applications on another computer. These are .Net remoting and .Net Web services. How do these two technologies differ and how are they similar? Let's take a look.
ADVERTISEMENT
Web Services
Web services are designed to allow a program on one system to make use of functionality on another system with all communication being done via the Internet.
Web services are not new with .Net, but they are certainly easier to implement than ever before. To create a Web service, you derive a class from System.Web.Services.WebService, and then add the methods that you want to
exposed, qualifying them with the WebMethod attribute. To consume a Web service,
you create a proxy for the service using the wsdl.exe utility or the Add Web Reference option in Visual Studio. There are a few more complexities, but the end result is that the Web service appears to your application like any local object.
But this is not meant to be a coding tutorial. How do Web services work?
Web services are based on using the standard HTTP protocol to transfer data back and forth. Requests and responses are serialized as SOAP messages. SOAP stands for Simple Object Access Protocol, a method for representing instructions and data in XML. The operation of a Web service is represented schematically in the following figure.