Hi Randy,
I've implemented some java that does this in an applet... here's the
meaty parts:
You can see it in action at: http://neuroinformatica.com/search.jsp
try typing the word 'brain'
Let me know if it is really slow responding to keystroks. I keep
meaning to
move the xmlrpc to another thread one of these days so that the typing
feedback is immediate.
Applet: Search.java
import java.net.URL;
import java.net.MalformedURLException;
import org.apache.xmlrpc.applet.SimpleXmlRpcClient;
import sun.misc.*;
public class Search extends java.applet.Applet // implements Runnable
{
SimpleXmlRpcClient client;
String codeBase = null;
public void init()
{
this.codeBase = "http://" + getCodeBase().getHost();
if (getCodeBase().getPort() != -1)
{
this.codeBase += ":" + getCodeBase().getPort();
}
try {
URL url = new URL (this.codeBase + "/RPC2");
System.out.println ("XML-RPC URL: "+url);
client = new SimpleXmlRpcClient (url);
} catch (MalformedURLException unlikely) {
System.out.println ("Error constructing XML-RPC client ");
}
}
class KeyActionListener implements ActionListener
{
/**
* Invoked when an action occurs.
*/
public void actionPerformed(ActionEvent e)
{
String query = itsTextField.getText();
if (query.length() < 2)
{
return;
}
try
{
Vector params = new Vector();
params.add(query);
Object rv = client.execute("neuroinfo.search", params);
itsList.removeAll();
itsListGUIDs.clear();
Vector hits = (Vector)rv;
for (int i = 0; i < hits.size(); i++)
{
Hashtable ht = (Hashtable)hits.get(i);
// should contain keys: guid, identifier, summary
String summary = (String)ht.get("summary");
String identifier = (String)ht.get("identifier");
itsList.add(identifier + " " + summary);
itsListGUIDs.add(ht.get("guid"));
}
}
catch (Exception ex)
{
System.out.println("shucks " + ex);
ex.printStackTrace();
}
}
}
}
> -----Original Message-----
> From: Randy Heiland [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, January 14, 2003 5:25 PM
> To: [EMAIL PROTECTED]
> Subject: [Webware-discuss] Java xmlrpc client
>
>
> This question should probably be directed to a different
> group, but since I'm
> in the context of Webware, I'll ask it here.
>
> Has anyone written a Java client analogous to this Python code?
>
> >>> import xmlrpclib
> >>> server =
> xmlrpclib.Server('http://myhost/cgi-bin/WebKit.cgi/Examples/XM
> LRPCExample')
>
>
> thanks,
> Randy
>
>
> -------------------------------------------------------
> This SF.NET email is sponsored by: Take your first step
> towards giving
> your online business a competitive advantage. Test-drive a Thawte SSL
> certificate - our easy online guide will show you how. Click
> here to get
> started: http://ads.sourceforge.net/cgi-bin/redirect.pl?thaw0027en
> _______________________________________________
> Webware-discuss mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/webware-discuss
>
-------------------------------------------------------
This SF.NET email is sponsored by: A Thawte Code Signing Certificate
is essential in establishing user confidence by providing assurance of
authenticity and code integrity. Download our Free Code Signing guide:
http://ads.sourceforge.net/cgi-bin/redirect.pl?thaw0028en
_______________________________________________
Webware-discuss mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/webware-discuss