Java Reference
In-Depth Information
Two kinds of data exchanges are conducted using XML-RPC: client requests and server
responses.
Sending a Request
An XML-RPC request is XML data sent to a web server as part of an HTTP post
request.
A post request normally is used to transmit data from a web browser to a web server—
Java servlets, common gateway interface programs, and other software collect the data
from a post request and send Hypertext Markup Language (HTML) back in response.
When you submit an email from a web page or vote in an online poll, you're either using
post or a similar HTTP request called get .
XML-RPC, on the other hand, is simply using HTTP as a convenient protocol for com-
municating with a server and receiving a response back.
The request consists of two parts: the HTTP headers required by the post transmission
and the XML-RPC request, which is expressed as XML.
Listing 20.1 contains an example of an XML-RPC request.
LISTING 20.1
An XML-RPC Request
1: POST /XMLRPC HTTP/1.0
2: Host: www.advogato.org
3: Connection: Close
4: Content-Type: text/xml
5: Content-Length: 151
6: User-Agent: OSE/XML-RPC
7:
8: <?xml version=”1.0”?>
9: <methodCall>
10: <methodName>test.square</methodName>
11: <params>
12: <param>
13: <value>
14: <int>13</int>
15: </value>
16: </param>
17: </params>
18: </methodCall>
In Listing 20.1, lines 1-6 are the HTTP headers, and lines 8-18 are the XML-RPC
request. This listing tells you the following:
 
Search WWH ::




Custom Search