1

I have to implement WCF web service in iPhone. But problem is that when i try to pass an object then it send me null value and when i post nil value for object then its give me response

SDZAuthService* service = [SDZAuthService service];
    service.logging = YES;
     service.username = [[NSUserDefaults standardUserDefaults] objectForKey:@"USERID"];
    service.password = [[NSUserDefaults standardUserDefaults] objectForKey:@"PASSWORD"];


    // Returns SDZLoginUserResult*. 
    //[service LoginFBUser:self action:@selector(LoginFBUserHandler:) fbUserId: @"" ctx: [[SDZServiceContext alloc] init]];

    SDZServiceContext *object=[[SDZServiceContext alloc]init];

    object.CallerUserId = 1;
    object.CallerUserHostAddress = @"127.0.0.1";
    object.ContextData = nil;
    // Returns SDZLoginUserResult*. 
    [service LoginUser:self action:@selector(LoginUserHandler:) userName:service.username password:service.password ctx:object];

If i pass nil value instead of passing object to ctx: then its send me reposne but for object it give me null value.

Thanks for your help Avnish

user821572
  • 19
  • 2

1 Answers1

1

You may know that in Objective-C nil is for reference objects and NULL is for non-object pointers (C references & such). Sounds like the client code is not initializing the ctx after the service call is made. If you control the WCF service, you should enable message logging to see what the service is receiving.

Community
  • 1
  • 1
Sixto Saez
  • 12,610
  • 5
  • 43
  • 51