?

Log in

No account? Create an account
XMLRPC, Newbie take 2: Login returns odd fault - LiveJournal Client Discussions [entries|archive|friends|userinfo]
LiveJournal Client Discussions

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

XMLRPC, Newbie take 2: Login returns odd fault [Dec. 24th, 2004|06:32 pm]
LiveJournal Client Discussions

lj_clients

[lordandrei]
[mood |confusedconfused]

I've switched over to using the OS's built in XMLRPC deliver mechanism.

This has allowed me to successfully make a call to getChallenge.

Using the return data I've tried a login. This is returning a strange error:

"FaultCode" = -1; 
"FaultString" = "Can't use string (\"0\") as a HASH ref while \"strict refs\" in 
    use at /home/lj/cgi-bin/ljprotocol.pl line 2359.\n"; 


The code I'm trying is below. Please note, it is Cocoa for OSX.

Any advice would be warmly welcomed...

Thanks

  NSURL *aURL = [NSURL URLWithString:@"http://www.livejournal.com/interface/xmlrpc"];
  NSDictionary *result;
  NSDictionary *theChallenge = [self getChallenge];
  NSMutableDictionary *params = [NSMutableDictionary dictionaryWithCapacity:4];
	
  NSString *theChallengeKey = [theChallenge objectForKey:@"challenge"];
  NSString *thePWHash = [@"XXXXXXXX" md5];  // My password
  NSString *theResponse = [[NSString stringWithFormat:@"%@%@", theChallengeKey, thePWHash] md5];
	
  [params setObject:@"XXXXXXXX" forKey:@"username"]; // My username
  [params setObject:@"challenge" forKey:@"auth_method"];
  [params setObject:theChallengeKey forKey:@"auth_challenge"];
  [params setObject:theResponse forKey:@"auth_response"];

  WSMethodInvocationRef inv = WSMethodInvocationCreate(
    (CFURLRef)aURL,
    (CFStringRef)@"LJ.XMLRPC.login",
    kWSXMLRPCProtocol);
	
  if(params != nil) {
    NSArray *order = [NSArray arrayWithObject: @"struct"];
    WSMethodInvocationSetParameters(inv, (CFDictionaryRef)params, (CFArrayRef)order);
  }
	
  CFDictionaryRef result = WSMethodInvocationInvoke(inv);

  if(WSMethodResultIsFault(result))
    NSLog([(NSDictionary *)result description]);

linkReply

Comments:
[User Picture]From: xb95
2004-12-25 09:27 pm (UTC)
Instead of pasting in code in a language I can't understand, perhaps try pasting in packet captures from the stream to/from the server... of course, blip out your password.

That'd help a helluva lot more than looking at some code... thanks!
(Reply) (Thread)