使用xml正文发送POST请求,并使用AFNetworking 3.x接收xml响应 [英] send POST request with xml body and recieve xml response with AFNetworking 3.x

查看:132
本文介绍了使用xml正文发送POST请求,并使用AFNetworking 3.x接收xml响应的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用xml主体编写 AFNetworking 3.x 发布请求,并从服务器接收xml(因为服务器接受xml输入并输出xml)。我已经成功完成了JSON,但是xml却有问题。

Hi I'm trying to write AFNetworking 3.x post request with xml body and receive xml from server (because server accept xml input and out put xml). I've done successful with JSON but have problem with xml.

如何修改这些模板以发送xml正文并接收xml响应。
,我们应该使用哪个库来解析xml响应?任何帮助都非常感谢。谢谢

How to modify these template to send xml body and receive xml response. and what library should we use to parse the xml response? Any help is much appreciate. Thanks

NSURLSessionConfiguration *configuration = [NSURLSessionConfiguration defaultSessionConfiguration];
AFURLSessionManager *manager = [[AFURLSessionManager alloc] initWithSessionConfiguration:configuration];

NSURL *URL = [NSURL URLWithString:@"http://httpbin.org/get"];
NSURLRequest *request = [NSURLRequest requestWithURL:URL];

NSURLSessionDataTask *dataTask = [manager dataTaskWithRequest:request completionHandler:^(NSURLResponse *response, id responseObject, NSError *error) {     
    if (error) {  
        NSLog(@"Error: %@", error);
    } else {     
        NSLog(@"%@ %@", response, responseObject);  
    }   
}];
[dataTask resume];


推荐答案

这是您所寻找答案的链接为。

this is a link with the answer that you are looking for .

尝试一下

H @ ppy c0de !!

这篇关于使用xml正文发送POST请求,并使用AFNetworking 3.x接收xml响应的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆