0

我基本上尝试通过 metablogweb API 方法 getRecentPosts 获取最近的帖子。但是我得到的只是一个 UnknonHostException 我不知道为什么,因为名称是正确的,而且用户数据也是正确的。我错过了什么吗?

06-10 10:48:53.273: W/System.err(330): java.net.UnknownHostException: name.wordpress.com
06-10 10:48:53.291: W/System.err(330):  at java.net.InetAddress.lookupHostByName(InetAddress.java:506)
06-10 10:48:53.291: W/System.err(330):  at java.net.InetAddress.getAllByNameImpl(InetAddress.java:294)
06-10 10:48:53.311: W/System.err(330):  at java.net.InetAddress.getAllByName(InetAddress.java:256)
06-10 10:48:53.311: W/System.err(330):  at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:136)
06-10 10:48:53.321: W/System.err(330):  at org.apache.http.impl.conn.AbstractPoolEntry.open(AbstractPoolEntry.java:164)
06-10 10:48:53.330: W/System.err(330):  at org.apache.http.impl.conn.AbstractPooledConnAdapter.open(AbstractPooledConnAdapter.java:119)
06-10 10:48:53.340: W/System.err(330):  at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:359)
06-10 10:48:53.362: W/System.err(330):  at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:555)
06-10 10:48:53.370: W/System.err(330):  at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:487)
06-10 10:48:53.392: W/System.err(330):  at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:465)
06-10 10:48:53.401: W/System.err(330):  at org.xmlrpc.android.XMLRPCClient.callEx(XMLRPCClient.java:178)
06-10 10:48:53.411: W/System.err(330):  at org.xmlrpc.android.XMLRPCClient.call(XMLRPCClient.java:332)
06-10 10:48:53.420: W/System.err(330):  at at.tug.bac.utils.XMLRPCConnector.testRPC(XMLRPCConnector.java:65)
06-10 10:48:53.431: W/System.err(330):  at at.tug.bac.blogroid.SetupBlogActivity$1.onClick(SetupBlogActivity.java:38)
06-10 10:48:53.431: W/System.err(330):  at android.view.View.performClick(View.java:2485)
06-10 10:48:53.441: W/System.err(330):  at android.view.View$PerformClick.run(View.java:9080)
06-10 10:48:53.460: W/System.err(330):  at android.os.Handler.handleCallback(Handler.java:587)
06-10 10:48:53.460: W/System.err(330):  at android.os.Handler.dispatchMessage(Handler.java:92)
06-10 10:48:53.483: W/System.err(330):  at android.os.Looper.loop(Looper.java:123)
06-10 10:48:53.503: W/System.err(330):  at android.app.ActivityThread.main(ActivityThread.java:3683)
06-10 10:48:53.503: W/System.err(330):  at java.lang.reflect.Method.invokeNative(Native Method)
06-10 10:48:53.521: W/System.err(330):  at java.lang.reflect.Method.invoke(Method.java:507)
06-10 10:48:53.531: W/System.err(330):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
06-10 10:48:53.540: W/System.err(330):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
06-10 10:48:53.540: W/System.err(330):  at dalvik.system.NativeStart.main(Native Method)

我的代码是:

    uri = URI.create("http://name.wordpress.com/");
    String user = "***";
    String passw = "***";
    int numberOfPosts = 3;
    int blogId = 42; //Not applicable for WordPress, can be any value and will be ignored.
    client = new XMLRPCClient(uri);
    client.setBasicAuthentication(user, passw);

    try {
  client.call("metaWeblog.getRecentPosts",blogId,user,passw,numberOfPosts);

    } catch (XMLRPCException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }

谢谢任何帮助。

4

0 回答 0