The Grabber.NET Application

Summary

Remoting is the distributed object infrastructure for .NET. Because SOAP is one of the message formats it supports, you can use Remoting to create Web services. The primary purpose of the Remoting framework is to serve as a distributed object infrastructure, not a development platform for creating and consuming Web services.

In a number of scenarios, Remoting is a better choice than other technologies, such as ASP.NET, if not the only choice. It makes sense to build Remoting Web services applications when you need to use a transport protocol other than HTTP, when you need to host a Web server in a process besides IIS, and when you need strong support for .NET types.

In this chapter, you learn the difference between well-known objects and client-activated objects. You should use well-known objects when your Web service needs to interoperate with clients created on other Web service development platforms.

Remoting supports two configurations for well-known objects, singleton and single instance. If the well-known object is configured as a singleton, all requests will be processed by the same object. If the well-known object supports the single instance configuration, each request will be processed by a new instance of the object.

Remoting Web services can be hosted in any process. This is a significant advantage for creating Web services that are not practical to host in IIS, such as the peer-to-peer Grabber.NET application that I implemented in this chapter.

In this chapter, I show how to create a Web service hosted in IIS and another one hosted in a WinForms process. I then explain how to consume Web services using the Remoting platform. I show three ways to create a strongly typed proxy object: using the new operator, using the Activator class's static GetObject method to dynamically create a strongly typed proxy, and using the SoapSuds utility to create a proxy from a WSDL document or a .NET assembly.

The SoapSuds utility can create a wrapped proxy object, which provides convenient access to some of the properties of the underlying channel object. For example, a wrapped proxy object exposes properties that allow you to set the username and password that will be used to authenticate the client.

The Remoting framework provides a set of tools and services for generating WSDL documents for your Web services. A WSDL document is automatically generated for Remoting Web services hosted in IIS when you append a query string containing wsdl to the end of the port address. You can also use the SoapSuds utility to generate a WSDL document for a given set of .NET types. This allows a WSDL document to be produced for a Web service hosted within a process other than IIS.

Remoting provides support for setting and processing SOAP headers. It offers two mechanisms for setting SOAP headers through the CallContext object. You use the GetHeaders and SetHeaders static methods to set and retrieve the SOAP headers for a particular method call, and you use the GetData and SetData static methods to set and retrieve data that will be sent within the header of the SOAP request message sent to an object that resides within a particular context.



Building XML Web Services for the Microsoft  .NET Platform
Building XML Web Services for the Microsoft .NET Platform
ISBN: 0735614067
EAN: 2147483647
Year: 2002
Pages: 94
Authors: Scott Short

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net