Andrei Freeman (lordandrei) wrote in lj_clients,
Andrei Freeman
lordandrei
lj_clients

  • Mood:

XMLRPC, Newbie take 2: Login returns odd fault

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]);

Subscribe

  • 302: lj_dev

    In the interests of consolidating all LiveJournal development-related discussion, we're going to be closing down this community. The same…

  • Plain text to LJ

    I have an old blog from xanga that's in html/plain text and I want to move it over here. Which client would be the best to do this? I also want to…

  • ljKlient 0.2.0 Preview Release 1

    Today marks another milestone in the development of ljKlient — as the first preview of the 0.2 series is released.  Please go to the project…

  • Post a new comment

    Error

    Comments allowed for members only

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

  • 1 comment