tonybaldwin: tony baldwin (Default)
tonybaldwin ([personal profile] tonybaldwin) wrote2010-04-06 10:46 am

xmlrpc posting with Xpostulate

Okay...I've started to hack up the xmlrpc functions.
First, I had to replace all "<" and ">" in html tags in a post with"&lt;" and "&gt;",
and then, I have basically just handwritten out a relevant xml file.
Which looks like this:

<?xml version="1.0"?><methodCall><methodName>LJ.XMLRPC.postevent</methodName><params><param><value><struct><member><name>username</name><value><string>tonytraductor</string></value></member><member><name>password</name><value><string>XXXXXXXX</string></value></member><member><name>subject</name><value><string>xmlrpc posting</string></value></member><member><name>lineendings</name><value><string>pc</string><value></member><member><name>year</name><value><int>2010</int></value></member><member><name>mon</name><value><int>04</int></value></member><member><name>day</name><value><int>06</int></value></member><member><name>hour</name><value><int>10</int></value></member><member><name>min</name><value><int>46</int></value></member><member><name>prop_current_location</name><value><string>127.0.0.1</string></value></member><member><name>propr_current_mood</name><value><string>focused</string></value></member><member><name>prop_taglist</name><value><string>xmlrpc, xpostulate, wordpress, livejournal, dreamwidth, insanejournal</string></value></member><member><name>prop_currentmusic</name><value><string>none</string></value></member><member><name>userjournal</name><value><string>which journal?</string></value></member><member><name>event</name><value><string>Okay...I've started to hack up the xmlrpc functions.
First, I had to replace all "<" and ">" in html tags in a post with "&lt;" and "&gt;",
and then, I have basically just handwritten out a relevant xml file.


</string></value></member></struct></value></param></params></methodCall>


What I haven't done is tried to send such a file to a server, yet...
I'm not sure if the posting method has to be different from a flat post, in terms of simply sending this file as the post data...
More work...
But, hey, I'm working on it!
catness: (Default)

[personal profile] catness 2010-04-07 04:57 am (UTC)(link)
Actually, the idea is that the programmer doesn't have to parse (or to build) xml files manually, but to use an already existing parser. My previous client used flat interface, and I can assure you that xml is a lot more simple and clean, as you can refer to variables by their keys, and don't have to see the actual data at all.

You're just a bit unlucky that you're using a non-mainstream language which doesn't have a good xml-rpc implementation yet. Even then, you can write that yourself, and then use it for all the other sites (e.g. wordpress) in exactly the same way (and other Tcl users probably will appreciate it too! the problem is solved once and for all.) While with flat interface, the programmer has to write a new parser for each protocol because there are no standards.

The purpose of challenge/response method is security; when you send password in cleartext, everyone can snoop on your traffic and get access to your account, especially with wireless (and from what I'm reading on Bash, people actually do it). I suggest that for now you get xml-rpc working without it. I'll explain challenge/response later, when I'll be more awake. And here's a better reference, with an example in Perl: http://www.livejournal.com/doc/server/ljp.csp.auth.challresp.html which also shows the simplicity of using XML-RPC interface.
catness: (Default)

[personal profile] catness 2010-04-07 02:58 pm (UTC)(link)
A few keywords are wrong:

- it's usejournal, not userjournal (anyway it can be omitted if you post in your own journal)

- the prop names must not have "prop_" prepended to it, i.e. it is: current_location, current_mood, taglist and current_music (see http://www.livejournal.com/doc/server/ljp.csp.proplist.html - it is different from flat interface)

- event: it's either "string" or "base64" but not both - if you do not encode it to base64, remove base64 tag, otherwise remove string tag (I'm not sure about this, but this is what I see in my data stream) - maybe that's the problem, event is a required field


Maybe you have to specify auth_method=clear, even though it's supposed to be default.