You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@roller.apache.org by April Pu <yp...@yahoo.com> on 2009/04/24 07:41:34 UTC
Help on roller MetaWeblog API
Hi,
I need to write code to test Metaweblog API. Does someone has smaple java code?
Thanks!
April
RE: Help on roller MetaWeblog API
Posted by Brian Levine <le...@hotmail.com>.
Not sure what you want to do with it, but I did a short writeup of what I did here:
http://roller.markmail.org/message/uysdhfuzi2ywnlda?q=programmatic+blog+entries
HTH
/Brian
> From: henning.brune@googlemail.com
> Date: Sun, 26 Apr 2009 08:58:37 +0200
> Subject: Re: Help on roller MetaWeblog API
> To: user@roller.apache.org; ypu01720@yahoo.com
>
> 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 <yp...@yahoo.com> 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/
_________________________________________________________________
Rediscover Hotmail®: Now available on your iPhone or BlackBerry
http://windowslive.com/RediscoverHotmail?ocid=TXT_TAGLM_WL_HM_Rediscover_Mobile2_042009
Re: Help on roller MetaWeblog API
Posted by April Pu <yp...@yahoo.com>.
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 <he...@googlemail.com> wrote:
> From: Henning Brune <he...@googlemail.com>
> Subject: Re: Help on roller MetaWeblog API
> To: user@roller.apache.org, ypu01720@yahoo.com
> 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
> <yp...@yahoo.com> 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/
Re: Help on roller MetaWeblog API
Posted by Henning Brune <he...@googlemail.com>.
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 <yp...@yahoo.com> 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/