国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 學(xué)院 > 開發(fā)設(shè)計 > 正文

IOS訪問webserver接口

2019-11-14 17:53:24
字體:
供稿:網(wǎng)友

   

接口調(diào)用參數(shù)只能是字符串格式,返回格式支持3種(字符串,數(shù)組,DataSet)

需要引用第三方庫,包含(DataSet,PlatServinceDataParser,WebserviceCommon,WebServiceHelper,xmlArrayParser,XMLDataSetParser,XMLResultParser)

程序中引用2個即可

#import "WebServiceCommon.h"

#import"DataSet.h"

 

- (void)getwebserver

{

   WebServiceCommon *webService=[[WebServiceCommonalloc] init];

    

    //方法一,取返回字符串

   NSString *result= [webServicegetResultWithURL:@"http://116.6.52.27:91/webservice/caskaforescService.asmx"xmlNS:nilmethod:@"GetCarTypeTree"pars:nil];

    NSLog(@"%@",result);

    [result release];

    //帶參數(shù)傳值調(diào)用方法

   NSMutableDictionary *dic=[[NSMutableDictionaryalloc]initWithObjectsAndKeys:@"test2",@"username",@"820826",@"passWord",@"1EB2D9848C5545E6BAEAA10B01222800",@"clubUserid",@"西南大區(qū)",@"BigArea",@"",@"

   NSString *result2= [webServicegetResultWithURL:@"http://116.6.52.27:91/webservice/caskaforescService.asmx"xmlNS:nilmethod:@"GetClub"pars:dic];

    NSLog(@"%@",result2);

    [dic release];

    [result2 release];

    

    //方法二,取返回數(shù)據(jù)組

    NSArray *array=nil;

   NSMutableDictionary *dic2=[[NSMutableDictionaryalloc]initWithObjectsAndKeys:@"...",@"VerifyCode", @"",@"objParams",@"20120615170225282486",@"sAccountBookID", @"XYTY124",@"productModel", @"馨原奕絨",@"brandName", nil];

    array=[webServicegetArrayWithURL:@"http://resourceservice.41go.cn/systemupdate.asmx"xmlNS:nilmethod:@"GetProductPriceInfoExt"pars:dic2];

   NSLog(@"productmodel=%@;name=%@,key=%@",[arrayobjectAtIndex:2],[arrayobjectAtIndex:3],[arrayobjectAtIndex:10]);

   //判斷數(shù)據(jù)中的空值(NSArray,NSMutableDictionary等)

    if ([array objectAtIndex:10]==[NSNullnull]) {

        NSLog(@"空值!");

    }

    [dic2 release];

   //方法三,取返回DataSet

    [webServiceinitDataSetWithURL:@"http://resourceservice.41go.cn/systemupdate.asmx"xmlNS:nilmethod:@"GetYarnList"pars:nil];

    NSMutableDictionary *wb=[webService.myDataset.TablesobjectForKey:@"YarnList"];//YarnList表名,如果沒有命名則為Table

    NSInteger count=[[webService.myDataset.TablesobjectForKey:@"YarnList"]count];

    for (int ii=0; ii<count; ii++) {

        NSMutableDictionary *dictemp=[wb objectForKey:[NSStringstringWithFormat:@"%d",ii]];

       NSLog(@"col1=%@;col2=%@;col3=%@",[dictempobjectForKey:@"C_AccountBookID"],[dictempobjectForKey:@"C_Name"],[dictempobjectForKey:@"C_YarnID"]);

    }

 

    [webService release];

 

}


發(fā)表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發(fā)表
主站蜘蛛池模板: 璧山县| 南汇区| 平湖市| 桂林市| 曲阜市| 铜川市| 海原县| 鹿邑县| 万州区| 湖北省| 邯郸市| 都安| 公主岭市| 佳木斯市| 沾益县| 七台河市| 长兴县| 东莞市| 澳门| 玛多县| 宁远县| 益阳市| 乌兰察布市| 基隆市| 万安县| 威信县| 手游| 合川市| 阳春市| 融水| 清涧县| 河西区| 屏边| 织金县| 甘泉县| 舞阳县| 乃东县| 高清| 牡丹江市| 德州市| 荔波县|