Log in

No account? Create an account
I'm writing a C# client in the .NET framework. And I'm running… - LiveJournal Client Discussions — LiveJournal [entries|archive|friends|userinfo]
LiveJournal Client Discussions

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

[Jun. 23rd, 2002|04:56 pm]
LiveJournal Client Discussions
[mood |boredbored]
[music |Foo Fighters - Walking After You]

I'm writing a C# client in the .NET framework. And I'm running into some trouble with the server communication.

I open a socket to the server and send the following string

String toSend = "POST /interface/xmlrpc HTTP/1.1\r\n" + "Host: www.livejournal.com\r\n" +"Content-Type: text/xml\r\n" + "Content-length: ";
toSend += blah.Length + "\r\n\r\n" + blah;

blah is the name of the string that contains the following XML.

<?xml version="1.0"encoding="utf8"?><methodCall><methodName>login</methodName><struct><member><name>username</name><value>indif69</value></member><member><name>password</name><value>-----</value></member></struct></methodCall>

and this is what I get back from the server

HTTP/1.1 200 OK
Date: Sun, 23 Jun 2002 20:42:03 GMT
Server: Apache
Content-Length: 360
Content-Type: text/xml
SOAPServer: SOAP::Lite/Perl/0.55
X-Cache: MISS from www.livejournal.com
Connection: close

<?xml version="1.0" encoding="UTF-8"?><methodResponse><fault><value><struct><member><name>faultString</name><value><string>Denied access to method (login) in class (main) at /usr/share/perl5/SOAP/Lite.pm line 2128.

What am I doing wrong? and how do I fix it?


[User Picture]From: codedragon
2002-06-24 03:49 am (UTC)
Bearing in mind that I know very very little C# (I treat it as Java's evil twin :D), I have noticed one thing:

You're using CRLF's to create linebreaks in the header that you send. Just as an experiment, try using \n instead of \r\n at the end of each line. That *might* help.

(Reply) (Thread)
From: evan
2002-06-24 11:34 am (UTC)
I believe \r\n is what the HTTP spec requires; I know LJ refuses stuff that doesn't follow the spec. When we implemented that, we broke a lot of clients, but it's their own fault, because:
Doesn't .net have an HTTP request class that handles this stuff for you? You shouldn't ever need to construct that sort of thing.
(Reply) (Parent) (Thread)
From: indif69
2002-06-24 02:37 pm (UTC)
well, I'm completely new to the .NET framework. and i examined the documentation and indeed found a class to do that for me. now I just have to work on the server to like the XML I generate and send.
(Reply) (Parent) (Thread)
[User Picture]From: badfritz
2002-06-24 09:00 am (UTC)
you might find this community ljnetdev interesting ..
(Reply) (Thread)
From: indif69
2002-06-24 02:48 pm (UTC)
hmm, i downloaded it and looked over the code a bit. i learned quite a bit from the code, but i still have to figure out this xmlrpc stuff. i should be able to use that code in my project as long as I release my code under the GPL also (i think), i might reuse that code with modifications.
(Reply) (Parent) (Thread)