|A little XML-RPC hand holding please
||[Sep. 24th, 2003|04:36 pm]
LiveJournal Client Discussions
I'm having difficulty figuring out how to programmatically build the parameter structure using Java and XML-RPC. I'm using org.apache.xmlrpc I'd like to see what code I need to write if I just want to login to LJ. I figured this much:|
XmlRpcClient xmlrpc = new XmlRpcClient("http://www.livejournal.com:80/interface/xmlrpc");
XmlRpcClient's method to call procedures is
public Object execute(String method, Vector params)
If I want to login to my LJ account, LJ's XML-RPC API specifies that I have to use a struct of key/value pairs for the params. However, the Vector structure does not have keys... only values. So I'm kind of at a loss on what to do. How do you populate the vector with the right values? and how do you retreive the values from the returned Object when, say, the login procedure returns?
Just out of curiosity, why don't you use the Flat interface, if using Java?
XML encoding in general, really bloats things up... and the flat interface seems both easy to parse, and rather concise. Both seem to require an HTTP request for each command, so it's whether or not sending post variables and parsing line-based output, or sending/receiving XML data is more efficient.
Then again, you may not want to bother parsing / transmitting the flat interface :-P
Well right now I'm in the process of learning Java & SWT. I'm doing an LJ client just to get some working experience with the language. So yeah, XML-RPC saves me from having to bother with HTTP.
My LJ client will be a Semagic clone. Up until now I've only worked on the GUI. Here's what it looks like:
No, this is not a screenshot of Semagic :)
Semagic has wayyyys to go in regards to GUI design... IMHO. I've been tempted to do a LJ client myself too, but I'm restricted by my employer not to release any binaries or source to anything I write while working there (ugh)
How are you detecting music? I looked for a while at the Winamp SDK, it seems like you need to send Windows messages to detect the current song... which would at least make you use JNI, or invoke some platform specific command...
Well since I have to distribute a different package for each platform anyways (since SWT uses a native library), I'll make my own shared library for any platform specific stuff (music detection, tray icon, toolbar icons).
And as for GUI design, I agree it could be better but it's still the most usable Win32 GUI I've tried. Anyways, my goal is not to design a GUI so much as learn how to use Java and the SWT toolkit.
2003-09-25 08:30 am (UTC)
Re: why XML RPC?
so you want to get ui part of semagic and link it with xml-rpc protocol written in java? what compiler are you using?
I'm using Sun's JDK 1.4.2
The screenshot you see above is all written in Java using the SWT GUI toolkit. None of the Semagic code was used.
In case you don't know, SWT is a toolkit developed by IBM which uses the OS's native widgets to render the UI. The library detects whatever platform it's running on and uses the Win32 API on Windows, GTK2 on Linux and Cocoa on OS X (I think). It's much faster and uses less memory that SWING or AWT.
See this site for more info:http://www.eclipse.org
2003-09-26 01:29 am (UTC)
Re: why XML RPC?
i forgot that you said you wanted to study programming. i whouldn't do something that was already done except if i wanted to study. (Actually I wrote programs from the beginning only when i was like 12 yo, now i mostly modify parts written by others especially because i do scientific programming).
In your place if i wanted to write a client (if the primary goal is not iterplatform compatibility) i whould have used parts already written and add written by me in java or any other language, this whould give also experience with multu-language linking.
Well I'm already gonna get some multi-language linking experience because SWT doesn't support all the features I want to implement. For example, there's no support for tray icons in SWT so I'm gonna do my own C or C++ library to implement this for each platform.
I don't really feel like reusing parts of other projects since I would lose an opportunity to learn new things by having to implement them myself.
BTW, if I ever release my project to the public, it's not gonna be called Sema-J or anything close to the Semagic name. And I'm gonna change the GUI so that people don't think it's your project they are using. Just so that people don't get confused.