Hi, I am writing an iphone application that exchanges a web service. Therefore, I have two text fields, the program should read the value of the first text field and publish the web service, and then after the response from the web service it needs to write a second text field. But in the second text box he writes nothing. it prints null on the console. Why is this getting? Thanks.
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil { self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]; if (self) { nodeContent = [[NSMutableString alloc]init]; } return self; } - (IBAction)login:(id)sender { NSLog(@"PASSWORD text: %@",password.text); if ([password.text length]==0) { UIAlertView *alert = [[UIAlertView alloc]initWithTitle:@"WebService" message:@"Supply Data in text field" delegate:nil cancelButtonTitle:nil otherButtonTitles:@"ok",nil]; [alert show]; [alert release]; } else { NSString *soapFormat = [NSString stringWithFormat:@"<?xml version=\"1.0\" encoding=\"utf-8\"?>\n" "<soap:Envelope xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">\n" "<soap:Body>\n" "<CelsiusToFahrenheit xmlns=\"http://tempuri.org/\">\n" "<Celsius>%@</Celsius>\n" "</CelsiusToFahrenheit>\n" "</soap:Body>\n" "</soap:Envelope>\n",password.text]; NSLog(@"The request format is %@",soapFormat); NSURL *locationOfWebService = [NSURL URLWithString:@"http://www.w3schools.com/webservices/tempconvert.asmx"]; NSLog(@"web url = %@",locationOfWebService); NSMutableURLRequest *theRequest = [[NSMutableURLRequest alloc]initWithURL:locationOfWebService]; NSString *msgLength = [NSString stringWithFormat:@"%d",[soapFormat length]]; [theRequest addValue:@"text/xml" forHTTPHeaderField:@"Content-Type"]; [theRequest addValue:@"http://tempuri.org/CelsiusToFahrenheit" forHTTPHeaderField:@"SOAPAction"]; [theRequest addValue:msgLength forHTTPHeaderField:@"Content-Length"]; [theRequest setHTTPMethod:@"POST"];
source share