Webservice 接口
NSString *soapMsg=[NSStringstringWithFormat:@"<?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>" ?? ? ? ? ? ? ? ? ? ? ?"<getWeatherbyCityName xmlns="http://WebXml.com.cn/">" ?? ? ? ? ? ? ? ? ? ? ?"<theCityName>%@</theCityName>" ?? ? ? ? ? ? ? ? ? ? ?"</getWeatherbyCityName>" ?? ? ? ? ? ? ? ? ? ? ?"</soap:Body>" ?? ? ? ? ? ? ? ? ? ? ?"</soap:Envelope>",@"青岛" ?? ? ? ? ? ? ? ? ? ? ? ]; ? ?NSURL *url=[NSURLURLWithString:@"http://www.webxml.com.cn/WebServices/WeatherWebService.asmx"]; ? ? NSString *msgLength=[NSString stringWithFormat:@"%d",[soapMsg length]]; ? ?NSMutableURLRequest *request=[NSMutableURLRequestrequestWithURL:url]; ? ? [requestaddValue:@"text/xml; charset=utf-8" forHTTPHeaderField:@"Content-Type"]; ? ? [request addValue: msgLength forHTTPHeaderField:@"Content-Length"]; ? ? [request setHTTPMethod:@"POST"]; ? ? [requestsetHTTPBody:[soapMsgdataUsingEncoding:NSUTF8StringEncoding]]; ? ?NSData *data=[NSURLConnectionsendSynchronousRequest:requestreturningResponse:nilerror:nil]; ? ?NSMutableString *result=[[NSMutableStringalloc]initWithData:dataencoding:NSUTF8StringEncoding]; ? ? NSLog(@"获得结果是%@",result); (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
- scala – SBT ProGuard插件:OutOfMemoryError,如
- angularjs – 带逗号的Angular货币格式化程序
- twitter-bootstrap-3 – Bootstrap折叠 – 全部展
- yum 彻底删除nodejs,重新安装
- 重写bootstrap css
- scala – 为什么这组解析器组合器溢出堆栈?
- scala – 在Slick中使用DatabaseConfig和Databas
- No.21 Yum(Yellowdog Updater Modified)软件管理
- angularjs – header-bar和class = bar-header之
- 对于日期字符串yyyymmdd ,Bash -value对于base(错