.NET Remoting and Delphi
(Page 1 of 11 )
The .NET remoting architecture is flexible and it provides a framework that can be customized and extended. Learn about object activation, distributed architectures, and the benefits of multi-tier application development. (From
Delphi for .NET Developer's Guide by Xavier Pacheco (Sams, 2004, ISBN: 0672324431).
Remoting is the process through which applications communicate across certain boundaries. The simplest form of boundary is a process, whereas a more complex one (and more common) is a network.
COM, DCOM, CORBA are all remoting technologies that, despite the different names and the incompatibles, work following a similar pattern: A client packages the name and parameters of a request, sends it over the boundary to a predefined location, and waits for a response.
Remoting technologies allow you to enter the world of "distributed systems" and achieve a level of flexibility and scalability not possible otherwise.
Remoting Technologies Available Today
Forms of Remoting have been usable from Delphi for a long time.
You could have used the COM/DCOM or CORBA frameworks included since version 3, the support for SOAP WebServices introduced in version 6, or even just simple TCP/IP components such as Indy.
The following section lists some of the most common remoting technologies available in the IT industry.
Sockets
Sockets are the basis of all network communication and allow developers to access network resources as if they were streams.
Sockets give full control to developers when it comes to low-level features. Unfortunately, sockets are difficult to program and add unnecessary complexity to the development of distributed applications.
All the other technologies listed in this section are built on top of sockets and provide developers with abstraction layers that simplify communication.
RPC
RPC is both an abbreviation for Remote Procedure Call and a specification designed by the the Open Group (http://www.opengroup.org/).
RPC outlined many of the architectural pillars used in Remoting technologies such as DCOM, SOAP, and CORBA.
These include
proxies and stubs: code present on clients and servers whose purpose is to make remote calls look as if they were local
data marshalling: the process of packaging a stream of data containing a request name and its parameters
interface definition language (IDL): a type of document that lists the name and parameters of the procedures that remote clients can invoke
Refer to http://www.opengroup.org/ for more information.
Java RMI
Java RMI enables programmers to create distributed Java to Java applications in which the methods of remote Java objects can be invoked from other Java virtual machines on the same or different computer.
It is the equivalent of .NET Remoting for the Java platform, but it is only accessible from Java environments.
Refer to http://java.sun.com/products/jdk/rmi/ for more information.
CORBA
CORBA is the abbreviation for Common Object Request Broker Architecture, and it is an open, vendor-independent specification defined by the Object Management Group (http://www.omg.org).
Companies such as Borland, Iona, PrismTech, and 2AB provide products that implement the specification.
CORBA is based on the IIOP protocol to transmit messages.
Read more about CORBA at http://www.omg.com and about IIOP at http://www.omg.org/gettingstarted/corbafaq.htm#RemoteInvoke.
XML-RPC
XML-RPC is a specification for an XML-based messaging protocol designed to work over HTTP.
The XML-RPC encoding is very simple to understand and use and provides support for most simple data types (integers, strings, and so on) and complex structures (objects).
Many XML-RPC implementations are available for the Linux, Unix, and Windows platforms.
Refer to http://www.xmlrpc.com for more information.
DCOM
The Distributed Component Object Model (DCOM) was the technology recommended by Microsoft for building distributed applications and, simply put, allows to access COM automation servers from remote computers.
DCOM was designed to work using different network transports (that is, TCP/IP and HTTP), to be cross platform, and it was based on the Open Group DCE-RPC specification.
Although the framework provides support for non-x86 architectures and has been ported to some Unix platforms, it has never been successful on non-Microsoft platforms.
Delphi supported DCOM, starting from version 3, with a framework that greatly simplified the development of DCOM servers and clients.
COM-Interop
COM-Interop is a technology that enables .NET and COM/DCOM applications to interoperate with each other. COM-Interop was covered in Chapter 16.
SOAP
SOAP is the acronym for Simple Object Access Protocol. The official definition found in the recent 1.2 specification says:
SOAP is a lightweight protocol intended for exchanging structured information in a decentralized, distributed environment. SOAP uses XML technologies to define an extensible messaging framework, which provides a message construct that can be exchanged over a variety of underlying protocols. The framework has been designed to be independent of any particular programming model and other implementation specific semantics.
SOAP is the foundation of Web Services (applications programmatically accessible by remote clients via HTTP) and is a de facto standard supported by many vendors including Microsoft, IBM, Borland, and Sun.
While relatively new, SOAP is the most accepted protocol for cross-platform communication. It is one of the best candidates to write systems accessible by applications written in any language, from any platform. Figure 29.1 illustrates this relationship.

Figure 29.1
SOAP cross-platform communication.
Microsoft .NET SDK provides a lot of infrastructure and prebuilt classes to create and consume Web Services that are fully accessible from Delphi.
You can build SOAP servers and clients in both Delphi 7 and Delphi for .NET, although the approach you have to use is very different.
.NET Remoting
.NET technologies use the term .NET Remoting to indicate two different things:
A form of remoting that uses binary messaging and is native to .NET
The foundation of classes that allow for any kind of remoting in .NET (either SOAP, binary, or user defined)
Throughout this chapter and Chapter 30, we will use the second definition.
The binary messaging protocol available in the .NET Remoting framework is Microsoft's official replacement for COM/DCOM. It is the most efficient way to make .NET applications communicate with each other, but, differently from SOAP, it is not meant for cross-platform communication because it only works between .NET applications.
We'll see how to create applications that use this form of remoting later in this chapter and in Chapter 30.
This chapter is from Delphi for .NET Developer's Guide, by Xavier Pacheco (Sams, 2004, ISBN: 0-672-32443-1). Check it out at your favorite bookstore today.
Buy this book now. |
Next: Distributed Architectures >>
More .NET Articles
More By Xavier Pacheco