Creating an XML-RPC Web service - XML-RPC

Started by sukishan, Aug 23, 2009, 12:02 AM

previous topic - next topic
Go Down


Remote Procedure Calls are used to establish and facilitate transactions between two remote systems. Example of popular RPC implementations include DCOM and CORBA. XML-RPC is an established implementation of RPC that allows you to transport XML encoded data between two servers using HTTP. In the following examples, we will use an implementation of XML-RPC originally developed by Edd Dumbill (

To enable PHP XML-RPC functionality, you must download the XML-RPC toolkit available at the following link:

Creating an XML-RPC Web service
The main include files we will be using are (the base class library) and (the server class library). Here is how you implement a simple XML-RPC server using PHP. First, we bring in both the client and server libraries using include statements:

Then we define a new function called onttax. This function will be the backbone of a web service that will calculate the 15% Federal & Provincial sales tax for Ontario Canada based on a dollar amount. A parameter, which corresponds to the dollar amount, is passed into the function. The parameter is then converted to a scalar variable. Once the calculation is completed, a response is created (using the xmlrpcresp class) returning the value of the sales tax:

function onttax($par){
return new xmlrpcresp(new xmlrpcval($taxcalc, "string"));
Then we can instantiate the server and serialize our onttax function back to the caller.

$server=new xmlrpc_server(array("taxcalc.onttax"=>array("function"=>"onttax")));
A good beginning makes a good ending

Go Up

Quick Reply

With Quick-Reply you can write a post when viewing a topic without loading a new page. You can still use bulletin board code and smileys as you would in a normal post.

Warning: this topic has not been posted in for at least 120 days.
Unless you're sure you want to reply, please consider starting a new topic.

Note: this post will not display until it's been approved by a moderator.
Please leave this box empty:

Type the letters shown in the picture
Listen to the letters / Request another image

Type the letters shown in the picture:

shortcuts: alt+s submit/post or alt+p preview
IT Acumens Web Designing Chennai | GinGly :: Build your Personal Website | CineBuzz :: Cinema News | My Kids Diary :: Gift your Kids Memories :: Book Website @ 349 Rs monthly
Copyright 2005 - 2021 :: IT Acumens :: All Rights Reserved. :: XML Sitemap
ITAcumens Discussion Forum with 2 lakhs post running for 15 years - Powered by IT Acumens Pro Dedicated Server

My Kids Diary