How do I create with Java a well formatted request to publish on WordPress with XML-RPC?

I’ve found this guide on internet to publish on WordPress using XML-RPC inside my Java Project, for example I want a message on my Blog, every time it’s specified date.
http://wordpress.rintcius.nl/post/look-how-this-wordpress-post-got-created-from-java

Now, I’ve followed the guide and I’m trying to let it run but I don’t understand yet how exactly parameters for my post works.
For example using the method blogger.NewPost I call:

Read More
    public Integer post(String contents) throws XmlRpcException {
    Object[] params = new Object[] {
        blogInfo.getApiKey(),
        blogInfo.getBlogId(),
        blogInfo.getUserName(),
        blogInfo.getPassword(),
        contents,
        postType.booleanValue()
    };
    return (Integer) client.execute(POST_METHOD_NAME, params);
    }

and my “contents” value is:

    [title]Look how this wordpress post got created from java![/title]"
        + "[category]6[/category]"
        + FileUtils.getContentsOfResource("rintcius/blog/post.txt");

(I’m using “[” instead of “<” and “]” instead of “>” that are processed by stackoverflow)

Now, how could I use all parameters in this XML way?
Parameters here: http://codex.wordpress.org/XML-RPC_MetaWeblog_API#metaWeblog.newPost

And, it’s the content only a “string” without any tag?

Thanks a lot to all!

Related posts

Leave a Reply

1 comment