Java Requires Chilkat v11.0.0+
Chilkat2 Java
HTTP XMLRPC
See more HTTP Examples
Demonstrates an XML-RPC call to WordPress. WordPress ships with two test methods in its XML-RPC server, one of which is the "demo.sayHello" method. This example demonstrates sending the "demo.sayHello" XML-RPC request to Chilkat's cknotes.com Wordpress server.Chilkat Java Downloads
import com.chilkatsoft.chilkat2.ChilkatException;
import com.chilkatsoft.chilkat2.Http;
import com.chilkatsoft.chilkat2.HttpResponse;
public class ChilkatExample {
public static void main(String[] args) {
// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
Http http = new Http();
String xmlReq = "<?xml version=\"1.0\"?><methodCall><methodName>demo.sayHello</methodName><params /></methodCall>";
HttpResponse resp = new HttpResponse();
try {
http.httpStr("POST", "http://www.cknotes.com/xmlrpc.php", xmlReq, "utf-8", "text/xml", resp);
} catch (ChilkatException e) {
System.out.println(e.getLastErrorText());
return;
}
System.out.println(resp.getBodyStr());
}
}