0
我必须用一些XML数据创建HTTPS帖子,但是我需要在HTTP标头中发送XML。带有xml标头的iPhone HTTPS帖子
使用身体,我会做这样的事情
request = [[NSMutableURLRequest alloc] initWithURL:url cachePolicy:CACHE_POLICY timeoutInterval:TIMEOUT_INTERVAL];
NSString *postLength = [NSString stringWithFormat:@"%d", [postData length]];
[request setHTTPMethod:@"POST"];
[request setValue:postLength forHTTPHeaderField:@"Content-Length"];
[request setValue:@"application/x-www-form-urlencoded" forHTTPHeaderField:@"content-type"];
[request setHTTPBody:postData];
connection = [[NSURLConnection alloc] initWithRequest:request delegate:self];
但是,这并不为头的工作,任何人都知道怎么做呢? XML是这样的
<request>
<code1>666</code1 >
<code2>656</code2 >
<code3>767</code3 >
</request >
谢谢。
你说得对,我已经试过了,但我的HTTP标头是错误的这就是为什么我认为这不起作用。谢谢 – iDevZilla 2010-07-16 13:18:05