我想从 iphone 中的特定 URL 进行简单的 XML 调用,但是在调用时我每次都没有得到更新的结果,我已经检查了 URL,但仍然没有得到实际结果,
听到的是 .m 控制器代码
//This is SOAP calling
NSString *postString = @"<?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"
"<GetCountries xmlns=\"http://www.webserviceX.NET\"/>\n"
"</soap:Body>\n"
"</soap:Envelope>";
//this is calling from URL wia above SOAP
dataWebService = [[NSMutableData data] retain];
NSURL *tempURL = [NSURL URLWithString:[NSString stringWithFormat:@"http://www.webservicex.net/country.asmx"]];
NSMutableURLRequest *request = [[NSMutableURLRequest requestWithURL:tempURL] retain];
NSString *postLength = [NSString stringWithFormat:@"%d", [postString length]];
[request addValue:@"text/xml; charset=utf-8" forHTTPHeaderField:@"Content-Type"];
[request addValue:@"http://www.webserviceX.NET/GetCountries" forHTTPHeaderField:@"SOAPAction"];
[request addValue:postLength forHTTPHeaderField:@"Content-Length"];
[request setHTTPMethod:@"POST"];
[request setHTTPBody:[postString dataUsingEncoding:NSUTF8StringEncoding]];
NSURLConnection * myConnection = [NSURLConnection connectionWithRequest:request delegate:self];
[myConnection start];
NSLog(@"%@Testing ",myConnection);
[request release];
提前致谢