tags:

views:

338

answers:

4

Can anyone explain to me the benefits of using XML-RPC over a straight HTML Form ? On first glance, they seem to accomplish the same thing. The XML-RPC is "formatted" using XML, but you can do the same in a form (think textbox).

I have an app that takes data from a script that runs on the client PC. The output from the script is XML. Currently it is submitted to the app (PHP using CodeIgniter) via a form POST. I have been told to look at using XML-RPC, but I am trying to understand "why"...

A: 

HTML forms are not comparable to XML-RPCs.

You use HTML forms to get some input data through a WebPage, while you use XML-RPC to execute remote procedures using XML.

Usually you will use XML-RPC for a process without a UI trying to execute some procedure remotely.

Pablo Santa Cruz
Well, I don't necessarily _need_ a form page. I can just have a page that accepts POST input, processes the XML and acts on it. No real (practical) difference, that I can see, from an XML_RPC.
Mark Unwin
I know. But keep in mind that if you say HTML FORM, you are referring to a form <form></form> on a page later submitted (POST) to a SCRIPT (the page that accepts POST input you are referring to). That's why I thought you were talking about different things.
Pablo Santa Cruz
A: 

If you mean encoding data in the www-form-encoded (or "query string style") format vs POSTing XML-RPC, it's really a matter of taste. Some people prefer to use XML for everything.

singpolyma
+2  A: 

I primary benefit of XML-RPC is that you don't have to write any (or nearly any) glue code to get remote processes to communicate. There are a wide variety of XML-RPC client libraries available for many languages. In the case that you have a rich API of functions, XML-RPC can be a very easy way connect remote processes to that API. Performing the same task with a plain www-form-encoded POST will require you to convert an API to a form and dispatch requests into api calls. There are a few systems that can help with that, but it is certain to be more difficult than just exposing the API through XML-RPC.

On the other hand, if (as it sounds) you already have a rich API exposed through plain form encoded requests, It's hard to justify the work of porting both client and server to another interface.

TokenMacGuy
A: 

XML-RPC is a bit dated, in my opinion. Unless you're talking about a different protocol, this is the one that preceeded SOAP. I wouldn't use it at all. Instead, I'd either use a SOAP-based service, or a REST-based one.

John Saunders
Why ? Why use SOAP or REST-based, versus XML-RPC. Just because it's old doesn't mean it's "bad"...
Mark Unwin
I disagree. Among other things, old means fewer tools, fewer people who know about it, less chance of bugs being fixed, etc. Besides, there are reasons it was replaced by SOAP. If there had been no reason, we wouldn't have SOAP.
John Saunders