About
xmlrpc is another name for soap.
Example with the xmlrpc api of wordpress
The code
include("/xmlrpc-2.2.2/lib/xmlrpc.inc");
// YOU MUST PLACE YOUR BLOGGER API KEY HERE
$XmlAppId = new xmlrpcval('', "string");
$BlogId = '';
$XmlBlogId = new xmlrpcval($BlogId, "string");
$UserLogin = 'userlogin';
$XmlUserLogin = new xmlrpcval($UserLogin, "string");
$UserPass = 'userpassword';
$XmlUserPass = new xmlrpcval($UserPass, "string");
$Content = "<title>Title!</title><category>NewCategory</category>My text blabla";
$XmlContent = new xmlrpcval($Content, "string");
$Publish = true;
$XMLPublish = new xmlrpcval($Publish, "boolean");
$Message = new xmlrpcmsg("blogger.newPost", array($XmlAppId, $XmlBlogId, $XmlUserLogin, $XmlUserPass, $XmlContent, $XmlPublish));
// You can try with the hello function
//$Message = new xmlrpcmsg("demo.sayHello", array($XmlBlogid, $XmlUserLogin, $XmlUserPass, $XmlContent, $XmlPublish));
print "<pre>Sending the following request:\n\n" . htmlentities($Message->serialize()) . "\n\nDebug info of server data follows...\n\n";
$Client = new xmlrpc_client("/weblog/xmlrpc.php", "gnico", 80);
$Client->setDebug(1);
$Reponse =& $Client->send($Message);
if (!$Reponse->faultCode()) {
$v = $Reponse->value();
print "</pre><br/>Reponse is "
. htmlspecialchars($v->scalarval()) . "<br/>";
// print "<HR>I got this value back<BR><PRE>" .
// htmlentities($Message->serialize()). "</PRE><HR>\n";
} else {
print "An error occurred: ";
print "Code: " . htmlspecialchars($Reponse->faultCode())
. " Reason: '" . htmlspecialchars($Reponse->faultString()) . "'</pre><br/>";
}
The message
<?xml version="1.0"?>
<methodCall>
<methodName>blogger.newPost</methodName>
<params>
<param>
<value>
<string></string>
</value>
</param>
<param>
<value>
<string></string>
</value>
</param>
<param>
<value>
<string>UserLogin</string>
</value>
</param>
<param>
<value>
<string>UserPassword</string>
</value>
</param>
<param>
<value>
<string><title>Title!</title><category>NewCategory</category>My text</string>
</value>
</param>
</params>
</methodCall>
Response
The number of the new post
<?xml version="1.0"?>
<methodResponse>
<params>
<param>
<value>
<int>131</int>
</value>
</param>
</params>
</methodResponse>
Reponse is 131
Support
An error occurred: Code: -32601 Reason: 'server error. requested method blogger_newPost does not exist.'
In the xmlrpc server, you can see the name to call in the function (on the left of the code below) :
'wp.getUsersBlogs' => 'this:wp_getUsersBlogs',
'wp.getPage' => 'this:wp_getPage',
'wp.getPages' => 'this:wp_getPages',
'wp.newPage' => 'this:wp_newPage',
'wp.deletePage' => 'this:wp_deletePage',
'wp.editPage' => 'this:wp_editPage',
'wp.getPageList' => 'this:wp_getPageList',
'wp.getAuthors' => 'this:wp_getAuthors',
'wp.getCategories' => 'this:mw_getCategories', // Alias
'wp.getTags' => 'this:wp_getTags',
'wp.newCategory' => 'this:wp_newCategory',
'wp.deleteCategory' => 'this:wp_deleteCategory',
'wp.suggestCategories' => 'this:wp_suggestCategories',
'wp.uploadFile' => 'this:mw_newMediaObject', // Alias
'wp.getCommentCount' => 'this:wp_getCommentCount',
'wp.getPostStatusList' => 'this:wp_getPostStatusList',
'wp.getPageStatusList' => 'this:wp_getPageStatusList',
'wp.getPageTemplates' => 'this:wp_getPageTemplates',
'wp.getOptions' => 'this:wp_getOptions',
'wp.setOptions' => 'this:wp_setOptions',
'wp.getComment' => 'this:wp_getComment',
'wp.getComments' => 'this:wp_getComments',
'wp.deleteComment' => 'this:wp_deleteComment',
'wp.editComment' => 'this:wp_editComment',
'wp.newComment' => 'this:wp_newComment',
'wp.getCommentStatusList' => 'this:wp_getCommentStatusList',
// Blogger API
'blogger.getUsersBlogs' => 'this:blogger_getUsersBlogs',
'blogger.getUserInfo' => 'this:blogger_getUserInfo',
'blogger.getPost' => 'this:blogger_getPost',
'blogger.getRecentPosts' => 'this:blogger_getRecentPosts',
'blogger.getTemplate' => 'this:blogger_getTemplate',
'blogger.setTemplate' => 'this:blogger_setTemplate',
'blogger.newPost' => 'this:blogger_newPost',
'blogger.editPost' => 'this:blogger_editPost',
'blogger.deletePost' => 'this:blogger_deletePost',
// MetaWeblog API (with MT extensions to structs)
'metaWeblog.newPost' => 'this:mw_newPost',
'metaWeblog.editPost' => 'this:mw_editPost',
'metaWeblog.getPost' => 'this:mw_getPost',
'metaWeblog.getRecentPosts' => 'this:mw_getRecentPosts',
'metaWeblog.getCategories' => 'this:mw_getCategories',
'metaWeblog.newMediaObject' => 'this:mw_newMediaObject',
// MetaWeblog API aliases for Blogger API
// see http://www.xmlrpc.com/stories/storyReader$2460
'metaWeblog.deletePost' => 'this:blogger_deletePost',
'metaWeblog.getTemplate' => 'this:blogger_getTemplate',
'metaWeblog.setTemplate' => 'this:blogger_setTemplate',
'metaWeblog.getUsersBlogs' => 'this:blogger_getUsersBlogs',
// MovableType API
'mt.getCategoryList' => 'this:mt_getCategoryList',
'mt.getRecentPostTitles' => 'this:mt_getRecentPostTitles',
'mt.getPostCategories' => 'this:mt_getPostCategories',
'mt.setPostCategories' => 'this:mt_setPostCategories',
'mt.supportedMethods' => 'this:mt_supportedMethods',
'mt.supportedTextFilters' => 'this:mt_supportedTextFilters',
'mt.getTrackbackPings' => 'this:mt_getTrackbackPings',
'mt.publishPost' => 'this:mt_publishPost',
// PingBack
'pingback.ping' => 'this:pingback_ping',
'pingback.extensions.getPingbacks' => 'this:pingback_extensions_getPingbacks',
'demo.sayHello' => 'this:sayHello',
'demo.addTwoNumbers' => 'this:addTwoNumbers'