views:

43

answers:

0

Hi,

I am using UITextField to get login and password from a user and then i use web service to send XML file using SOAP to a site and after successful authentication the user logs in and another screen is displayed. The next screen has a button to redirect to the previous screen where user can again enter login and password.

I enter login and password, and after checking the credentials by calling the webservice, next screen is displayed. Now going back to the login screen and when i enter invalid credentials the system logs using the last credentials. I have a different screen for each user so i am exactly sure it is using the last saved credentials.

This data is saved in a strange way as i have made it null in ViewDidAppear method. Releasing the UITextField doesnt work as it disappears completely. I am in severe trouble, can somebody suggest me an optimum solution,

Regards, Taimur

-(IBAction)ButtonPressed {

soapMessage = [NSMutableString string];

[soapMessage appendString:@"\n"];

[soapMessage appendString:@"\n"];

[soapMessage appendString:@"\n"];

[soapMessage appendString:@"\n"];

[soapMessage appendFormat:@"%@\n", userId.text];

[soapMessage appendFormat:@"%@\n", password.text];

[soapMessage appendString:@"\n"];

[soapMessage appendString:@"\n"];

[soapMessage appendString:@"\n"];

TaimurAppAppDelegate appDelegate = (TaimurAppAppDelegate) [[UIApplication sharedApplication] delegate];

NSURL *url = [NSURL URLWithString:appDelegate.baseURL];

NSMutableURLRequest *theRequest = [NSMutableURLRequest requestWithURL:url];

NSString *msgLength = [NSString stringWithFormat:@"%d", [soapMessage length]];

[theRequest addValue:@"text/xml; charset=utf-8" forHTTPHeaderField:@"Content-Type"];

[theRequest addValue:msgLength forHTTPHeaderField:@"Content-Length"];

[theRequest addValue:@"http://tempuri.org/ValidateUser" forHTTPHeaderField:@"SOAPAction"];

[theRequest setHTTPMethod:@"POST"];

[theRequest setHTTPBody:[soapMessage dataUsingEncoding:NSUTF8StringEncoding]];

NSString *temp;

temp = [NSString alloc];

temp = @""; }

-(void)viewDidAppear:(BOOL)animated {

userId.text = @"";

password.text = @"";

}