title: Consume ASP web service with JSON response on iOS
body: <p>I am trying to call a web service that is developed with ASP.NET. The purpose is to pass a username and password to the web service to simulate a log-in procedure.</p>
  
  <p>In order to call the service i used the following method:</p>
  
  <pre><code> NSError *errorReturned = nil;
      NSString *urlString = @"http:myDomain/myMethod?Operation=SignIn";
      NSURL *url = [NSURL URLWithString:urlString];
      NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url];
      [request setHTTPMethod: @"POST"];
      [request setValue:@"application/json" forHTTPHeaderField:@"Content-Type"];
      NSMutableDictionary *dict = [NSMutableDictionary dictionary];
      [dict setObject:@"test" forKey:@"userName"];
      [dict setObject:@"test" forKey:@"passWord"];
  
      NSData *jsonData = [NSJSONSerialization dataWithJSONObject:dict options:kNilOptions     error:&amp;errorReturned];
      [request setValue:[NSString stringWithFormat:@"%d", [jsonData length]] forHTTPHeaderField:@"Content-Length"];
      [request setHTTPBody: jsonData];
  
      NSURLResponse *theResponse =[[NSURLResponse alloc]init];
      NSData *data = [NSURLConnection sendSynchronousRequest:request returningResponse:&amp;theResponse error:&amp;errorReturned];
  
      if (errorReturned)
      {
          NSLog(@"%@", errorReturned);
      }
      else
      {
          NSString *retVal = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
          NSLog(@"%@", retVal);
  
      }
  </code></pre>
  
  <p>After running the app and clicking on the UIButton that fires the above method, nothing is shown in the console window. </p>
  
  <p>The service returns the response in JSON format.</p>
  
  <p>I want to know if i am missing something here since i am neither getting an error nor success log?</p>
  
  <p>Any help would be appreciated!</p>
  
  <p>Thank you.</p>
  
  <p>Granit</p>