?

Log in

No account? Create an account
XML-RPC Newbie question. - LiveJournal Client Discussions [entries|archive|friends|userinfo]
LiveJournal Client Discussions

[ userinfo | livejournal userinfo ]
[ archive | journal archive ]

XML-RPC Newbie question. [Dec. 23rd, 2004|10:20 am]
LiveJournal Client Discussions

lj_clients

[lordandrei]
[mood |curiouscurious]

I am trying to get a better understanding of XML-RPC

I've manually created the getchallenge request. But for some reason I keep getting back a fault error. Any pointers or comments would be appreciated.

The set up:
I telnet directly to test.livejournal.com 80
I send the request
I receive the fault.

POST /interface/xmlrpc HTTP/1.0
POST /interface/xmlrpc HTTP/1.0
User-Agent: Apolo Agent 0.1d
Host: www.livejournal.com
Content-Type: text/xml
Content-Length: 136

<?xml version="1.0"?>
<methodCall>
<methodName>LJ.XMLRPC.getchallenge</methodName>
<params>
<param>
</param>
</params>
</methodCall>


<?xml version="1.0" encoding="UTF-8"?>
<methodResponse>
<fault>
<value>
<struct>
<member>
<name>faultString</name>
<value>
<string>Application failed during request deserialization: 
unclosed token at line 8, column 0, byte 126 at /usr/lib/perl5/XML/Parser.pm line 185
</string>
</value>
</member>
<member>
<name>faultCode</name>
<value>
<string>Client</string>
</value>
</member>
</struct>
</value>
</fault>
</methodResponse>
linkReply

Comments:
[User Picture]From: breyten
2004-12-24 09:40 am (UTC)
Make sure that you calculate the Content-Length correctly. I'm too lazy to count bytes, but it's probably too short. (Maybe because of line-endings?). Try to paste in the example from the docs to see if that works.
(Reply) (Thread)
[User Picture]From: lordandrei
2004-12-24 04:30 pm (UTC)

One problem and curiosity seems to be that content length...

In the example page it lists the Length as: 193

However, counting from the 1st character from the POST line (depending on how CRs are counted) would cut off the example at:
<methodName%gt;LJ.XMLRPC.getc

Counting backwards from the end of the example 193 would put the first character at the Host line at the point: livejournal.com

So the content Length I list above is from counting characters from the point immediately after the Content-Length Value + 1 for and extra CR at the end.

Now, I'm not sure if my telnet client may be doing something strange with the CRs that are sent. But that's all that I have so far.

When I entered it manually (rather than cut and paste, the server reacted upon the last CR as if I did give it the correct Content Length.
(Reply) (Parent) (Thread)
[User Picture]From: breyten
2004-12-24 04:41 pm (UTC)

Re: One problem and curiosity seems to be that content length...

Are you perhaps copying from another terminal/dos box. They tend to copy blocks, not chracters. So you'd get extra spaces :)
(Reply) (Parent) (Thread)