【问题标题】:How to send a soap array as a parameter to a web service objective C [duplicate]如何将soap数组作为参数发送到Web服务目标C [重复]
【发布时间】:2011-05-20 19:50:07
【问题描述】:

可能重复:
How to access SOAP services from iPhone

在我的应用程序中。我想向网络服务发送一个数组

【问题讨论】:

    标签: iphone service


    【解决方案1】:

    我用这个方法来解析不同参数的soap

    NSString *soapMessage = [NSString stringWithFormat:@"" “” “” “” “%@” “%@” “” “” "",[clientRefString valueForKey:@"Type"],[clientRefString valueForKey:@"feeEarner"]]; //NSLog(@"soapMessage : %@",soapMessage);

    //NSString *body = [[NSString alloc]initWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"GetSearchMatter" ofType:@"txt"],@"OMI",@"SPA005"];
    ////NSLog(@"%@",body);
    
    NSURL *serviceURL = [[NSURL alloc] initWithString:@"http://82.110.35.93/oneoffice.asmx?op=SearchCosts"];
    NSMutableURLRequest *request = [[NSMutableURLRequest alloc] initWithURL:serviceURL];
    [request setHTTPMethod:@"POST"];
    [request setValue:@"text/xml" forHTTPHeaderField:@"Content-Type"];
    [request setHTTPBody:[soapMessage dataUsingEncoding:NSUTF8StringEncoding]];
    NSData *data = [NSURLConnection sendSynchronousRequest:request returningResponse:nil error:nil];
    NSString *dataStr = [[NSString alloc]initWithData:data encoding:NSUTF8StringEncoding];
    [dataStr release];
    [serviceURL release];
    [request release];
    //[body release];
    if(xmlParser)
    {
        [xmlParser release];
        xmlParser = nil;
    }
    xmlParser = [[NSXMLParser alloc] initWithData:data];        
    [xmlParser setDelegate:self];
    [xmlParser parse];  
    

    【讨论】:

    • 在我的应用程序中,我使用了从 sudzc.com 生成的代码,这里需要将数组传递给 Web 服务。但我无法传递数组
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-08-31
    • 2012-11-03
    • 1970-01-01
    • 2011-02-04
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多