Monday, 24 October 2005

Flocking XML-RPC

« BarCamp NYC | Main | Ratchet & Clank »

I was poking around the Flock bugzilla instance to see if anyone else had reported not being able to post to their blog from Flock. newPost xml-rpc not quite right (my emphasis in italicized bold).

recent versions of drupal (http://drupal.org/) use an XML-RPC that does strict
type checking against method signatures. as such, newPost (metaweblog or
blogger) fails on drupal because Flock sends the "publish" paramater as an "int"
rather than a "boolean" as the spec calls for
.

So, let's see, what happens if I now add the following method to blojsom's MetaWeblog API handler.

public String newPost(String blogid, String userid, String password, Hashtable struct, int publish) throws Exception {
return newPost(blogid, userid, password, struct, (publish == 0) ? false : true);
}

Let's try posting to a local blog and see what messages we have on the console. Are we happy yet?

Oct 24 15:30:40 DEBUG [http-8080-Processor25] handlers.MetaWeblogAPIHandler - newPost() Called ===========[ SUPPORTED ]=====
Oct 24 15:30:40 DEBUG [http-8080-Processor25] handlers.MetaWeblogAPIHandler - BlogId: testing/
Oct 24 15:30:40 DEBUG [http-8080-Processor25] handlers.MetaWeblogAPIHandler - UserId: david
Oct 24 15:30:40 DEBUG [http-8080-Processor25] handlers.MetaWeblogAPIHandler - Password: *********
Oct 24 15:30:40 DEBUG [http-8080-Processor25] handlers.MetaWeblogAPIHandler - Publish: true
Oct 24 15:30:40 DEBUG [http-8080-Processor25] blog.FileBackedBlogEntry - Created blog entry file: /Users/czarnecki/weblogs/testing/Test-post-from-Flock.html
Oct 24 15:30:41 DEBUG [http-8080-Processor25] blog.FileBackedBlogEntry - Saved meta-data to: /Users/czarnecki/weblogs/testing/Test-post-from-Flock.meta
Oct 24 15:30:41 DEBUG [http-8080-Processor25] blog.FileBackedBlogEntry - Loaded meta-data from: /Users/czarnecki/weblogs/testing/Test-post-from-Flock.meta
Oct 24 15:30:41 DEBUG [Thread-35] weblogsping.WeblogsPingPlugin - Pinged notification URLs based on blog entry event

So, the question is, who needs to change? Do I need to change blojsom's handlers to support software that is sending an int when it should be sending a boolean as per the specification? There isn't a specification I've looked at (1, 2, 3) where anyone is calling for an int in place of a boolean. It's easy enough to add and this isn't meant to be that much of a bitch, but come on here /images/emoticons/mozilla_laughing.gif

And yes, as noted in the comments, an XML-RPC console panel would help to debug. But, a little localhost action goes a long way.

P.S. Also needed to update the editPost function as well.

public boolean editPost(String postid, String userid, String password, Hashtable struct, int publish) throws Exception {
return editPost(postid, userid, password, struct, (publish == 0) ? false : true);
}

Which yields entry editing happiness.

Oct 24 15:50:01 DEBUG [http-8080-Processor22] handlers.MetaWeblogAPIHandler - editPost() Called ========[ SUPPORTED ]=====
Oct 24 15:50:02 DEBUG [http-8080-Processor22] handlers.MetaWeblogAPIHandler - PostId: testing/?permalink=Test-post-from-Flock.html
Oct 24 15:50:02 DEBUG [http-8080-Processor22] handlers.MetaWeblogAPIHandler - UserId: david
Oct 24 15:50:02 DEBUG [http-8080-Processor22] handlers.MetaWeblogAPIHandler - Password: *********
Oct 24 15:50:02 DEBUG [http-8080-Processor22] handlers.MetaWeblogAPIHandler - Publish: true
Oct 24 15:50:02 DEBUG [http-8080-Processor22] blog.FileBackedBlogEntry - Loaded meta-data from: /Users/czarnecki/weblogs/testing/Test-post-from-Flock.meta
Oct 24 15:50:02 DEBUG [http-8080-Processor22] blog.FileBackedBlogEntry - Saved meta-data to: /Users/czarnecki/weblogs/testing/Test-post-from-Flock.meta
Oct 24 15:50:02 DEBUG [Thread-38] weblogsping.WeblogsPingPlugin - Pinged notification URLs based on blog entry event

And with that, we're done.

Technorati Tags:

Posted by david at 3:57 PM in blojsom ... all blojsom

 

[Trackback URL for this entry]

Pingback: Another Caffeinated Day at Mon, 7 Aug 9:30 PM

Flocking XML-RPC
a blessing in reality. Second, downloaded Flock to give it a spin. WTF people, is XML-RPC really that hard? The 0.7.4.1 build still has a broken implementation of the MetaWeblogAPI, the details are here... I think what sets me off about this is that the

Your comment:

(not displayed)
 
 
 

Live Comment Preview:

 
« First  « Prev   1 2 3 4 5   Next »  Last »
« October »
SunMonTueWedThuFriSat
      1
2345678
9101112131415
16171819202122
23242526272829
3031