Using XML-RPC with PHP - Dissection of a XML-RPC Response
(Page 4 of 7 )
And here's the response to the call:
HTTP/1.1 200 OK
Connection: close
Content-Length: 191
Content-Type: text/xml
Date: Tue, 18 Dec 2001 14:23:52 GMT
Server: xmlrpc-epi-php/0.2 (PHP)
<?xml version='1.0' encoding="iso-8859-1" ?>
<methodResponse>
<params>
<param>
<value>
<string>Hello Lucas. How are you today?</string>
</value>
</param>
</params>
</methodResponse>
With your newly found knowledge of XML-RPC calls, it is easy
to decipher standard responses. Normal responses consist of
<params> container with
<param> elements (and all they are heir to) sent inside
<methodResponse> tags, but there is another type of response - a fault:
HTTP/1.1 200 OK
Connection: close
Content-Length: 356
Content-Type: text/xml
Date: Tue, 18 Dec 2001 13:52:25 GMT
Server: Apache/1.3.20
<?xml version='1.0' encoding="iso-8859-1" ?>
<methodResponse>
<fault>
<value>
<struct>
<member>
<name>faultCode</name>
<value>
<int>4</int>
</value>
</member>
<member>
<name>faultString</name>
<value>
<string>Too many parameters.</string>
</value>
</member>
</struct>
</value>
</fault>
</methodResponse>
As you can see, a fault response consists of a
<methodResponse> containing a <fault> which contains a
<value> which is a
<struct> containing two elements, one named
<faultCode>, an
<int> and one named
<faultString>, a
<string>.
Please note that a response cannot contain both a
<params> container and a
<fault> container.
Next: Creating an XML-RPC Server >>
More PHP Articles
More By Lucas Marshall