从iphone应用程序调用Web服务

时间:2011-03-02 12:16:40

标签: iphone objective-c web-services

有一个文件iPhone.asmx,它是用vb.net编写的,托管在服务器上。我需要在不使用SOAP的情况下访问该Web服务。我怎么能这样做?

1 个答案:

答案 0 :(得分:0)

基于website,可以在iphone中调用不带SOAP的WS。您只需在查询字符串中传递WS的参数即可。 所以你的代码看起来像:

NSURL * url = [NSURL initWithString:@"http://host.com/WS?param1=val1&param2=val2"];
 NSURLRequest *request = [NSURLRequest initWithURL:url];
 NSURLConnection *connection = [NSURLConnection initWithRequest:request delegate:self startImmediately:YES ];