MarthinusSwart.com

XML-RPC Introduction

There are many cases where a C# application needs to communicate with a Java backend. To accomplish this feat there are also a few solutions available. Some solutions are commercial and some not.

Personally I am a big XML-RPC fan, a few reasons why would be the following

  • XML-RPC libraries are available for almost all popular languages
  • The interfaces between the client and server is easy to maintain
  • The XML-RPC XML data is smaller than SOAP
  • Easier to change the interfaces with less hassle than something like CORBA

That is just a few reasons from the top of my head why I prefer XML-RPC to communicate between 2 disparate systems.

The deployment and actual implementation of an XML-RPC architecture can also vary widely. The easiest and quickest way is to communicate via HTTP. The C# client sends XML data via the HTTP connection to the Java server and receives XML data back as response. The C# client opens an HTTP stream to the Servlet and pumps the XML data to it, the servlet in turn might be the application decoding the XML or it could be a pure delegate that will just delegate the information to some other class or even some other bean.

I prefer the Servlet approach, it is easy and it will work on any Container that support Servlets from version 1.2 and up. It also allows me to use the same Servlet even when I am not using an application server and just plain old Java objects (POJO).

I have an implementation example of both the C# client and the Java server available.