Uncategorized

XML-RPC In A Nutshel

  • What is XML-RPC?

Machines need to talk to each other, but they all speak different languages. In order for them to communicate, they need a common ground for talking, a set of rules they could all follow and use to understand each other. XML-RPC is the name of one of the sets of rules people come up with. There are other specification of rules apart from XML-RPC, like JSON-RPC, SOAP, WSDL, CORBA and REST.

  • Okay, REST is something I at least hear about regularly. So if XML-RPC is something similar, tell me what REST’s rules are.

Basically computers who agree to use REST to communicate with each other all use these verbs to convey their intention: GET means I want to read a resource, POST means creating a resource, PUT means updating something by replacing it entirely, PATCH means partially updating, and DELETE means delete. Most of the time, they’re all HTTP calls, which greatly simplifies the I-want-to-Create/Read/Update/Delete communication.

  • What about XML-RPC’s rules?

With this one, our vocabulary pool is limited to GET and POST. We have to use things like “POST /removeItem?itemId=456” to convey a “DELETE /items/456”. Also, as its name suggests, you get your replies in XML.

  • Right. So XML-RPC basically just means getting XML back with POST calls. What do I do if I want to call them from the front end?

If you want to do XML-RPC calls from the front end, you will need to have the front-end files on the same domain as the server. Or do something to work around the Same Origin Policy (either CORS or proxy server). If you already have that covered, here are some examples:

 

Reference:

Standard