Hi, I have a tableview, when the user selects a row i call a webservice depending on which row is selected.
my problem is i can connect to the webservice but i dont get any response from the webservice. I used soap client to test if webservice is working correctly or not.
//rootviewcontroller.m
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {....
//call to webservice
[self connectToWebService];
}
On debugging i found that my code does not go to any of the following methods
-(void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *) response{}
-(void) connection:(NSURLConnection *) connection didReceiveData:(NSData *) data {}
-(void) connection:(NSURLConnection *) connection didFailWithError:(NSError *) error{}
-(void) connectionDidFinishLoading:(NSURLConnection *) connection {}
any suggestions where am i going wrong??? thanks
-(void)connectToWebService
{
NSString *soapMsg = [NSString stringWithFormat:
@"<?xml version=\"1.0\" encoding=\"utf-8\"?>"
"<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/\">"
"<soap:Body>"
" <GetCount xmlns=\"http://192.168.1.104/Service1\">"
"<PropId>718</PropId>"
"</GetCount>"
"</soap:Body>"
"</soap:Envelope>"];
NSURL *url = [NSURL URLWithString:
@"http://192.168.1.104/defpath/service1.asmx"];
NSMutableURLRequest *req = [NSMutableURLRequest requestWithURL:url];
//---set the headers---
NSString *msgLength = [NSString stringWithFormat:@"%d",[soapMsg length]];
[req addValue:@"text/xml; charset=utf-8"
forHTTPHeaderField:@"Content-Type"];
[req addValue:@"http://192.168.1.104/defpath/Service1/GetCount"
forHTTPHeaderField:@"SOAPAction"];
[req addValue:msgLength forHTTPHeaderField:@"Content-Length"];
//---set the HTTP method and body---
[req setHTTPMethod:@"POST"];
[req setHTTPBody: [soapMsg dataUsingEncoding:NSUTF8StringEncoding]];
conn = [[NSURLConnection alloc] initWithRequest:req delegate:self];
if (conn) {
webData = [[NSMutableData data] retain];
}