[wp-xmlrpc] xmlrpc functions

prasath nadarajah n.prasath.002 at gmail.com
Sun Sep 19 17:38:16 UTC 2010


Hi,
I,m developing a weblog client for wordpress using java.
i wrote a simple program trying to communicate with wordpress xmlrpc.
but it throws the following error.

Exception: Failed to parse server's response: Expected methodResponse
element, got html

I just put the part of the coding where i input wp-xmlrpc method to
communicate with wordpress.

String result = (String)client.execute("sayHello", params);

// i think sayHello method does not require authentication to return
"hello".

i assume the rest of the code is ok.
can anyone tell me what went wrong in the input??


Below is the program for your reference. i have used apache xmlrpc
libraries.

*Program*
*import org.apache.xmlrpc.client.XmlRpcClient;
import org.apache.xmlrpc.client.XmlRpcClientConfigImpl;
import java.net.URL<http://download.oracle.com/docs/cd/E17409_01/javase/6/docs/api/java/net/URL.html>
;
import java.util.Vector<http://download.oracle.com/docs/cd/E17409_01/javase/6/docs/api/java/util/Vector.html>
;

public class SimpleXmlrpc {

public SimpleXmlrpc() {
}

public static void
main(String<http://www.coderanch.com/t/410859/java/java/String-StringBuffer-StringBuilder-Performance>[]
args) {

XmlRpcClientConfigImpl config = new XmlRpcClientConfigImpl();

try{

config.setServerURL(new URL("http://localhost/wordsite"));
XmlRpcClient client = new XmlRpcClient();
client.setConfig(config);

Object[] params = new Object[]{ new String("usrername"),
new String("password")
};

String result = (String)client.execute("sayHello", params); .
System.out.println("Results" + result);
}
catch(Exception e)
{
System.out.println("Exception: " + e.getMessage());
}
}
} *
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.automattic.com/pipermail/wp-xmlrpc/attachments/20100919/30f65832/attachment.htm>


More information about the wp-xmlrpc mailing list