Home » Wordpress » Getting an exception in wordpress post

Getting an exception in wordpress post

Posted by: admin November 30, 2017 Leave a comment

Questions:

I have a code to post data on word press i.e.-

    String username = "xyz";
    String password = "xyz";
    String xmlRpcUrl = "http://www.arrestcentral.com/xmlrpc.php?";
    WordPress wp = new WordPress(username, password, xmlRpcUrl);
    Page recentPost = new Page();
    String result = wp.newPost(recentPost, true);`

These same code was working 2 month but now its not working.
Now when I goes to post data is showing an exception i.e.-

redstone.xmlrpc.XmlRpcException: The response could not be parsed.

at redstone.xmlrpc.XmlRpcClient.handleResponse(Unknown Source)
at redstone.xmlrpc.XmlRpcClient.endCall(Unknown Source)
at redstone.xmlrpc.XmlRpcClient.invoke(Unknown Source)
at redstone.xmlrpc.XmlRpcProxy.invoke(Unknown Source)
at net.bican.wordpress.$Proxy1.newMediaObject(Unknown Source)
at net.bican.wordpress.Wordpress.newMediaObject(WordPress.java:582)
at WordPressPost.DataWordpressPost.DataPost(DataWordpressPost.java:53)
at arrestcentral.ArrestData.readPdf(ArrestData.java:420)
at arrestcentral.ArrestData.main(ArrestData.java:447)
Caused by: java.io.FileNotFoundException: http://www.arrestcentral.com/XMLrpc.php?
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1478)
... 9 more'

I am using

xmlrpc-client-1.1

WordPress 3.2.1

Answers:

http://www.arrestcentral.com/XMLrpc.php (as displayed in the stack trace) does not exist and returns a 404 error. Put that URL into your browser and you will see. This is exactly what you would expect.

http://www.arrestcentral.com/xmlrpc.php on the other hand does exist, and if you request it with no parameters you will get back:

XML-RPC server accepts POST requests only.

You need to use the correct url (http://www.arrestcentral.com/xmlrpc.php) without a trailing question mark:

String xmlRpcUrl = "http://www.arrestcentral.com/xmlrpc.php";

Leave a Reply

Your email address will not be published. Required fields are marked *