PHP to C# Interop using XML-RPC

Posted on March 4th, 2007 in Programming by Bayo Oyekole

I have to develop a client-server application, the connection bandwidth is not very high, the database is MySQL on a Linux server, and I have to use C# for the windows client. I can’t use ADO.NET for obvious reasons, and the MySQL ODBC Connector cannot be relied on for such a congested link. How do I do it? Thank God for XML and Web Services. After struggling with different models for days without success, the idea of using XML-RPC hit me when I saw the w.Bloggar application at work.

The first thing to understand about Web Services is they’re not really anything new. If you’ve ever used an RSS Feed to take news from another website and place it on your own (like I have done), you’ve already got a good idea of how Web Services work. Data exchange in a Web Service typically happens using standard HTTP protocol POSTs. In other words, Web Services operate in basically the same way your browser does when it POSTs an HTML form to a site, and receives a Web page in response. The only real difference is that, instead of HTML, Web Services use XML.

In “Web Services Demystified”, a standard called SOAP is examined, which is used to “package” data for exchange between two systems. SOAP is on its way to being the W3C standard for Web Services, and with backing from Microsoft and IBM will probably get the official stamp very soon. But another standard exists for the same purpose: XML-RPC. XML-RPC is a lightweight protocol intended for exchanging structured information in a decentralized, distributed environment, for sharing messages between client and server. It was developed to deal with the limitations of XML/HTTP. It’s been around since 1998, and although it’s not an official W3C standard, is already widely used, and has impressive support in the form of Open Source projects. Developed by Useful Inc. in conjunction with Microsoft, it can be regarded in many ways as the forerunner to SOAP, which hasn’t stopped running quite yet.

Now why did I choose to use XML-RPC? I would have used SOAP or REST but they were a little too complex for the task: the biggest thing XML-RPC has going for it is simplicity, which is clear from the start when you compare the 1500 word specification with SOAP’s 11,000 word (and growing) bible. For a detailed comparison of XML-RPC and SOAP, I’d recommend reading XML-RPC vs. SOAP. All I needed was to use Windows/C# to call a method generated by an alien development tool (PHP) on an alien platform (Linux), over the internet. There’s no point in killing a fly with a sledgehammer. The other reason for my choice is that XML-RPC is well supported in PHP, along with implementations in just about every other popular language.

Typically, Web Services are consumed by clients from another website, but there’s no reason why the client cannot be a desktop application. I am still trying out the different implementations of XML-RPC in PHP, to find the best ones to use. I hope this “experiment” of mine turns out to be as interesting and time-saving as I think it will be, because I am running out of time on my latest project.

I will delve into the topic deeper on later posts.

3 Responses to 'PHP to C# Interop using XML-RPC'

Subscribe to comments with RSS or TrackBack to 'PHP to C# Interop using XML-RPC'.

  1. Alex said,

    on May 26th, 2007 at 8:46 am

    Thank You

  2. Mark said,

    on June 10th, 2007 at 4:04 pm

    Thank You


  3. on June 12th, 2007 at 12:26 pm

    on behalf of gridlock the editorial team would like to thank you for your comments, and will strive to provide world class content for you.

Post a comment