iPhone开发 调用阿asp.net程序的webservice
//asp.net中的web.config中,需要開啟get方式或者post方式
<system.web>
<webServices>
<protocols>
<add name="HttpSoap">
<add name="HttpPost">
<add name="HttpGet">
<add name="Documentation">
</protocols>
</webService>
</system.web>
//iphone 代碼
NSString *urlString = @"http://www.yoursite.com/web.asmx/HelloWorld2?say=aaabbbccc";
?? ?
? ? NSURL *url = [NSURL URLWithString:urlString];
? ? NSURLRequest *urlRequest = [NSURLRequest requestWithURL:url
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? cachePolicy:NSURLRequestReturnCacheDataElseLoadtimeoutInterval:30];
?? ?
? ? NSData *urlData;
? ? NSURLResponse *response;
? ? NSError *error;
? ? urlData = [NSURLConnection sendSynchronousRequest:urlRequest returningResponse:&response error:&error];
?? ?
? ? NSString* retStr = [[NSStringalloc] initWithData:urlData encoding:NSUTF8StringEncoding];
轉載于:https://www.cnblogs.com/fanwa/archive/2012/02/15/2352176.html
總結
以上是生活随笔為你收集整理的iPhone开发 调用阿asp.net程序的webservice的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 联想 ThinkPad X1 Carbo
- 下一篇: 如何全面的把握一个系统的异常处理