The
Zend_XmlRpc_Client::call() method then handles the rest by compiling the XML encoded request and sending
it via HTTP to the XML-RPC server it was instantiated with.
Figure 11.6 Demonstrating the editPost() method call with the response on the left, the updated article in the middle and the
response returned from the XML-RPC server on the right.
Licensed to Menshu You
Zend Framework in Action (Ch01) Manning Publications Co. 28
Borrowing Ecto??™s console window we can illustrate the process a little more thoroughly in figure 11.6.
There we can see the XML encoded request in the left hand console window, which is processed by the XMLRPC
server and if successful will update the article in the middle and return an XML encoded response with
the boolean value true, back to the client.
Not all XML-RPC requests are successful of course and for that reason Zend_XmlRpc_Client has the
ability to handle HTTP and XML-RPC errors through exceptions. In listing 11.9 we add some error handling
to the editPost procedure call from listing 11.8.
Listing 11.9 Adding error handling to our XML-RPC client
try {
client->call('metaWeblog.editPost', A
array($id,'myusername','mypassword', $structData, $publish));
} catch (Zend_XmlRpc_HttpException $e) { B
// echo $e->getCode() .
Pages:
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329