Oh!!<div><br></div><div>The code shoud use "demo.sayHello"</div><div><br></div><div><span class="Apple-style-span" style="font-family: verdana, arial, helvetica, sans-serif; font-size: 12px; border-collapse: collapse; line-height: 18px; ">String result = (String)client.execute("demo.sayHello", params);</span></div>
<div><font class="Apple-style-span" face="verdana, arial, helvetica, sans-serif" size="3"><span class="Apple-style-span" style="border-collapse: collapse; font-size: 12px; line-height: 18px;"><br></span></font></div><div>
<font class="Apple-style-span" face="verdana, arial, helvetica, sans-serif" size="3"><span class="Apple-style-span" style="border-collapse: collapse; font-size: 12px; line-height: 18px;">Still it throws an exception!!!!<br>
</span></font><div><br><br><div class="gmail_quote">On Sun, Sep 19, 2010 at 11:08 PM, prasath nadarajah <span dir="ltr"><<a href="mailto:n.prasath.002@gmail.com">n.prasath.002@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
Hi,<div>I,m developing a weblog client for wordpress using java.</div><div>i wrote a simple program trying to communicate with wordpress xmlrpc.</div><div>but it throws the following error.</div><div><br></div><div><span style="font-family:verdana, arial, helvetica, sans-serif;font-size:12px;line-height:18px">Exception: Failed to parse server's response: Expected methodResponse element, got html</span></div>
<div><br></div><div>I just put the part of the coding where i input wp-xmlrpc method to communicate with wordpress.</div><div><br></div><div><span style="font-family:verdana, arial, helvetica, sans-serif;font-size:12px;line-height:18px">String result = (String)client.execute("sayHello", params);</span></div>
<div><span style="font-family:verdana, arial, helvetica, sans-serif;font-size:12px;line-height:18px"><br></span></div><div><span style="font-family:verdana, arial, helvetica, sans-serif;font-size:12px;line-height:18px">// i think sayHello method does not require authentication to return "hello".</span></div>
<div><span style="font-family:verdana, arial, helvetica, sans-serif;font-size:12px;line-height:18px"><br></span></div><div><font face="verdana, arial, helvetica, sans-serif" size="3"><span style="font-size:12px;line-height:18px">i assume the rest of the code is ok.</span></font></div>
<div><font face="verdana, arial, helvetica, sans-serif" size="3"><span style="font-size:12px;line-height:18px">can anyone tell me what went wrong in the input??</span></font></div>
<div><font face="verdana, arial, helvetica, sans-serif" size="3"><span style="font-size:12px;line-height:18px"><br></span></font></div><div><font face="verdana, arial, helvetica, sans-serif" size="3"><span style="font-size:12px;line-height:18px"><br>
</span></font></div><div><font face="verdana, arial, helvetica, sans-serif" size="3"><span style="font-size:12px;line-height:18px">Below is the program for your reference. i have used apache xmlrpc libraries.</span></font></div>
<div><font face="verdana, arial, helvetica, sans-serif" size="3"><span style="font-size:12px;line-height:18px"><br></span></font></div><div><font face="verdana, arial, helvetica, sans-serif" size="3"><span style="font-size:12px;line-height:18px"><u>Program</u></span></font></div>
<div><font face="verdana, arial, helvetica, sans-serif" size="3"><span style="font-size:12px;line-height:18px"><u><span style="border-collapse:collapse">import org.apache.xmlrpc.client.XmlRpcClient; <br>
import org.apache.xmlrpc.client.XmlRpcClientConfigImpl; <br>import <a href="http://download.oracle.com/docs/cd/E17409_01/javase/6/docs/api/java/net/URL.html" title="Java API" style="color:inherit;text-decoration:none;border-bottom-width:1px;border-bottom-style:dotted;border-bottom-color:rgb(85, 85, 85)" target="_blank">java.net.URL</a>; <br>
import <a href="http://download.oracle.com/docs/cd/E17409_01/javase/6/docs/api/java/util/Vector.html" title="Java API" style="color:inherit;text-decoration:none;border-bottom-width:1px;border-bottom-style:dotted;border-bottom-color:rgb(85, 85, 85)" target="_blank">java.util.Vector</a>; <br>
<br>public class SimpleXmlrpc { <br><br>public SimpleXmlrpc() { <br>} <br><br>public static void main(<a href="http://www.coderanch.com/t/410859/java/java/String-StringBuffer-StringBuilder-Performance" title="String vs. StringBuilder/StringBuffer" style="color:inherit;text-decoration:none;border-bottom-width:1px;border-bottom-style:dotted;border-bottom-color:rgb(85, 85, 85)" target="_blank">String</a>[] args) { <br>
<br>XmlRpcClientConfigImpl config = new XmlRpcClientConfigImpl(); <br><br>try{ <br><br>config.setServerURL(new URL("<a href="http://localhost/wordsite" style="color:rgb(0, 0, 204)" target="_blank">http://localhost/wordsite</a>")); <br>
XmlRpcClient client = new XmlRpcClient(); <br>client.setConfig(config); <br><br>Object[] params = new Object[]{ new String("usrername"), <br>new String("password") <br>}; <br><br>String result = (String)client.execute("sayHello", params); . <br>
System.out.println("Results" + result); <br>} <br>catch(Exception e) <br>{ <br>System.out.println("Exception: " + e.getMessage()); <br>} <br>} <br>} </span></u></span></font></div><div><font face="verdana, arial, helvetica, sans-serif" size="3"><span style="font-size:12px;line-height:18px"><br>
</span></font></div>
</blockquote></div><br></div></div>