Question

I am making an iphone application which has user information on a web server. When user wants to login, username and password will be sent to web server. In my case to a java servlet. Then servlet will check username and password in database and send response to iphone. I managed to send username and password using ASIHTTPRequest. But i dont know how should servlet send response back to iphone app to tell that username and password matches some user's account or not. I implemented following functions:

 - (void)requestFailed:(ASIHTTPRequest *)request
 {
[self.activity stopAnimating];
NSLog(@"Request failed: %@",[request error]);

 } 

 - (void)requestFinished:(ASIHTTPRequest *)request 
 { 
[self.activity stopAnimating];
NSLog(@"Response %d ==> %@", request.responseStatusCode, [request responseString]);

 } 

in console out put is: Response 200 ==>

How can i send response from my java servlet to the same request which comes from iphone? Thanks in advance.

Was it helpful?

Solution

[request responseString] is what you can see in your web browser. Just response a string, "OK", "NG" for example, on your server is OK (a JSON or a XML string is even better).

OTHER TIPS

i suggest using RESTKit

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top