[Project_owners] XML-RPC trouble

David Murray lid2000 at tpg.com.au
Fri Apr 1 01:03:06 EST 2005


Yes, it's me again, this time with another stupid problem. It seems that 
every afternoon I find myself tearing my hair out for 7 hours over a 
different problem. I'm trying to communicate with LiveJournal via 
XML-RPC. At the moment I'm just trying to get a challenge from the 
server, but keep getting shafted. Basically, the request seems to post 
off fine, but when I try to read the response I end up copping an alert 
box that reads like this:

Error: Component returned failure code 0x80470002 
(NS_BASE_STREAM_CLOSED) [nsIScriptableInputStream.available]

I honestly can't figure out *why* this is happening. Everything looks 
perfect. Here is the code in question (modified from MozBlog; every 
XMLRPC thing seems to stem from there):

---------------------

dsLogin.livejournal = function() {
	//var dictionary = 
Components.classes["@mozilla.org/dictionary;1"].createInstance("nsIDictionary");
	this.xmlrpc.init(dsAccounts.posturl);
	this.xmlrpc.asyncCall(this.RPCHandler, null, "LJ.XMLRPC.getchallenge", 
[], 0);
}

dsLogin.RPCHandler = {
	onResult: function(client, passedobject, result) {
	// Dies as soon as it reads the next line.
		    result = 
result.QueryInterface(Components.interfaces.nsISupportsArray);
	},
	onFault: function (client, ctxt, fault) {
		alert('XML-RPC Fault: '+fault);
	},
	onError: function (client, ctxt, status, errorMsg) {
		alert('Error: '+errorMsg);
	}
}

----------------------------

The LJ.XMLRPC.getChallenge method doesn't require any parameters, as 
described under 
http://www.livejournal.com/doc/server/ljp.csp.xml-rpc.getchallenge.html

I am without a clue. There seems to be no real documentation on the net 
aside from MozBlog's code, and tutorials based on it. Anyone know what 
they're doing?

David.



More information about the Project_owners mailing list