I am trying to access data from web services created for a project that I was working on. I create a line to create a request
NSMutableString *sRequest = [[NSMutableString alloc] init]; [sRequest appendString:@"<soapenv:Envelope xmlns:soapenv=\"http:blah blah blah /messages\">"]; [sRequest appendString:@"<soapenv:Header/>"]; [sRequest appendString:@"<soapenv:Body>"]; [sRequest appendString:@"<mes:processActionRequest>"]; [sRequest appendString:@"<ProcessAction>"]; [sRequest appendString:@"</mes:processActionRequest>"]; [sRequest appendString:@"</soapenv:Body>"]; [sRequest appendString:@"</soapenv:Envelope>"];
Then I create the url and request
NSURL *ServiceURL = [NSURL URLWithString:[[NSDictionary dictionaryWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"webservices" ofType:@"plist"]] valueForKey:@"EndPointURL"]]; NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:ServiceURL]; [request addValue:@"text/xml" forHTTPHeaderField:@"Content-Type"]; [request setHTTPMethod:@"POST"]; [request setHTTPBody:[sRequest dataUsingEncoding:NSUTF8StringEncoding]]; [UIApplication sharedApplication].networkActivityIndicatorVisible = YES; NSTimeInterval start = [NSDate timeIntervalSinceReferenceDate]; NSData *responseData = [NSURLConnection sendSynchronousRequest:request returningResponse:NULL error:NULL]; NSTimeInterval duration = [NSDate timeIntervalSinceReferenceDate] - start; NSLog(@"Response Time%.4f",duration); [UIApplication sharedApplication].networkActivityIndicatorVisible = NO; return responseData;
The problem is that the response time that I typed in the log is always above 20 seconds. But when I hit the same link with the eviware / SoapUI project, it runs for a second, also when the same link is used in the Blackberry project, it works smoothly. I do not understand where I am mistaken. Why is the iPhone a very slow answer. Please help. If I am not clear, please let me know. I will try to elaborate more.
source share