With all the help, following is my code, wish it would be helpful to new hands
on Roller:
public class rpcxml
{
public static void main(String [] args)
{
try
{
XmlRpcClientConfigImpl config = new
XmlRpcClientConfigImpl();
config.setServerURL(new
URL("http://.../roller/roller-services/xmlrpc"));
XmlRpcClient client = new XmlRpcClient();
client.setConfig(config);
Hashtable h = new Hashtable();
h.put("description","<div><img
src='http://www.google.com/intl/en_ALL/images/logo.gif'/><div><div>test
String</div>");
h.put("title","test post from xml-rpc");
Object[] params = new Object[]{"b6", "elwin", "1", h, true};
String result = (String)client.execute("metaWeblog.newPost",
params);
System.out.println(result);
}
catch(Exception e)
{
System.out.println(e.toString());
}
}
}
--- On Sun, 4/26/09, Henning Brune <[email protected]> wrote:
> From: Henning Brune <[email protected]>
> Subject: Re: Help on roller MetaWeblog API
> To: [email protected], [email protected]
> Date: Sunday, April 26, 2009, 2:58 AM
> Just take a look at Rome Propono:
>
> http://wiki.java.net/bin/view/Javawsxml/RomePropono
>
> I used this to migrate several thousands of messages from a
> legacy
> system to roller blog. Java code is quite simple, I used
> something
> like this:
>
>
> String BLOG_URL =
> "<YourBlogBaseDir>/roller-services/xmlrpc";
> String BLOG_USER = "<YourBlogUser>";
> String BLOG_PWD = "<YourBlogUserPassword>";
> String BLOG_HANDLE = "<YourBlogHandle>";
>
> BlogConnection con =
> BlogConnectionFactory.getBlogConnection(
> "metaweblog", BLOG_URL, BLOG_USER, BLOG_PWD);
>
> Blog blog = con.getBlog(BLOG_HANDLE);
> if (blog == null)
> throw new Exception("blog not found");
>
> Blog.Collection entries =
> blog.getCollection("entries");
>
> if (entries == null)
> throw new Exception("no entries found in blog");
>
> ....
>
> -Henning
>
> On Fri, Apr 24, 2009 at 7:41 AM, April Pu
> <[email protected]> wrote:
> >
> > Hi,
> >
> > I need to write code to test Metaweblog API. Does
> someone has smaple java code?
> >
> > Thanks!
> >
> > April
> >
> >
> >
> >
>
>
>
> --
> Dipl.-Inform. Henning Brune
>
> http://ekvv.uni-bielefeld.de/pers_publ/publ/PersonDetail.jsp?personId=10185
>
> Universität Bielefeld
> Projekt BIS
> Postfach 10 01 31
> D-33501 Bielefeld
>
> Die neue Homepage des BIS Projektes:
> http://www.uni-bielefeld.de/bis/