iOS - NSURLConnection - Connecting to server and get Nonce

Posted by Satyam svv on Stack Overflow See other posts from Stack Overflow or by Satyam svv
Published on 2011-11-30T09:48:33Z Indexed on 2011/11/30 9:50 UTC
Read the original article Hit count: 288

I'm writing iOS application. There's a server related to some real estate. I've to send the following request to server to get the Nonce.

GET /ptest/login HTTP/1.1 
Method: GET 
User-Agent: MRIS API 
Testing Tool/2.0 
Rets-Version: RETS/1.7 
Accept: */* 
Host: ptest.mris.com:6103 
Connection: keep-alive

I'm using ASI HTTP with following code to post:

[self setRequest:[ASIHTTPRequest requestWithURL:[NSURL URLWithString:@"/ptest/login"]]];
[request addRequestHeader:@"User-Agent" value:@"CARETS-General/1.0"];
[request addRequestHeader:@"Rets-Version" value:@"1.7"];
[request addRequestHeader:@"Connection" value:@"keep-alive"];
[request addRequestHeader:@"Accept" value:@"*/*"];
[request addRequestHeader:@"Host" value:"ptest.mris.com:6103"];
[request setDelegate:self];
[request setDidFinishSelector:@selector(topSecretFetchComplete:)];
[request setDidFailSelector:@selector(topSecretFetchFailed:)];
[request startAsynchronous];   

The response that I'm getting is
Error: Unable to start HTTP connection

Can some one point me how to establish successful connection?

© Stack Overflow or respective owner

Related posts about ios

Related posts about nsurlconnection