如何将soap数组作为参数发送到Web服务目标C

发布于 2024-10-06 08:47:55 字数 217 浏览 0 评论 0原文

可能的重复:
如何从 iPhone 访问 SOAP 服务

在我的应用程序中。我想将数组发送到网络服务

Possible Duplicate:
How to access SOAP services from iPhone

In my application . I want to send a array to web service

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

笔芯 2024-10-13 08:47:55

我使用此方法在具有不同参数的肥皂中进行解析

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];  

i use this method to parse in soap with different parameters

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];  
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文