XML-RPC Request

Author Topic: XML-RPC Request  (Read 365 times)

Offline chinmay.sahooTopic starter

  • Trade Count: (0)
  • Full Member
  • ***
  • Thank You 2
  • Posts: 139
  • Karma: 0
    • No Addiction
XML-RPC Request
« on: 12-14-2015, 02:25:28 »
XML-RPC requests function as HTTP POST requests. Therefore, it must have a proper HTTP POST header. The actual remote call and parameters, in XML format, follows the header as the body of the HTTP request.

User-Agent: PHP5 XML-RPC Client (Mac OS X)
Host: betty.userland.com
Content-Type: text/xml
Content-length: 181
<?xml version="1.0"?>

The first line in the header, POST and the Host line tell us that this XML-RPC call is to a web service that sits at betty.userland.com/RPC2. The name of the call to be requested, in this case, examples.getStateName, is the irst useful information in the message body. We pass an integer of 42 as the parameter to xamples.getStateName. Let's take a look at these elements one by one .

The root element in an XML-RPC call is methodCall. It has one required child element, methodName, which specifies the name of the call to be requested. There can only be one methodCall per request. If parameters are passed to the call, they are encapsulated in the params element.

A procedure call can require an unlimited number of parameters. XML-RPC calls do not have named parameters. In other words, you do not name your parameter before assigning a value, for example:

// This is wrong.Parameters are not named.
<param name="myInt">

Instead, for functions requiring more than one parameter, the correct parameter order is defined by the remote function. You will have to check the API's documentation for this information and make sure you order the parameters correctly.

//The correct way to differentiate parameters is in their order as defined by the API

In the request, each parameter is enclosed by a param element. Within each param, the actual parameter is wrapped up by a value element. Within this value element are the actual parameter values and data types.


Related Topics

  Subject / Started by Replies Last post
1 Replies
Last post 02-20-2011, 23:48:19
by Samual007
0 Replies
Last post 05-26-2011, 00:21:24
by myhomewealth
1 Replies
Last post 02-14-2012, 03:14:52
by rostwood22
5 Replies
Last post 12-02-2011, 08:50:59
by hjones
2 Replies
Last post 02-01-2016, 22:38:20
by RH-Calvin