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];
摘自 凡娃软件
相关新闻>>
- 发表评论
-
- 最新评论 更多>>
今日头条
更多>>您可能感兴趣的文章
- ios学习笔记(二)xcode 4.3.2下实现基本交互
- iPhone开发学习笔记006—— NSNotification自定义通知名
- Lexical or Preprocessor Issue 'xxx.h
- 多线程之NSInvocationOperation
- (iPhone/iPad开发)presentViewController相应方法在SDK5.0前后
- ios开发问题:添加库和复制其它工程文件编译错误问题
- iPhone应用开发之十一:常用的三种动画表现效果
- Memory on the iPhone
- Android:实现TabWidget选项卡按钮在屏幕下方
- iphone开发之object c基础一定义接口