[英]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. 我发现该指南可以在Internet上使用Java项目中的XML-RPC在Wordpress上发布,例如,每次指定日期时,我都希望在Blog上发送一条消息。 http://wordpress.rintcius.nl/post/look-how-this-wordpress-post-got-created-from-java
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:
例如,使用方法blogger.NewPost调用:
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) (我使用的是由stackoverflow处理的“ [”而不是“ <”和“]”而不是“>”)
Now, how could I use all parameters in this XML way? 现在,如何以这种XML方式使用所有参数? Parameters here: http://codex.wordpress.org/XML-RPC_MetaWeblog_API#metaWeblog.newPost
此处的参数: 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! 非常感谢大家!
Still don't know why it gives me back errors but i think it's only a bit outdated. 仍然不知道为什么它会给我带来错误,但是我认为这只是过时了一点。 Found this other libraries that works perfectly http://code.google.com/p/wordpress-java/
找到了其他可以正常运行的库http://code.google.com/p/wordpress-java/
I advice all to use this since the other one is outdated Thanks all 我建议所有人都使用它,因为另一个已经过时了。谢谢
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.