Hello Everybody我正在尝试通过HTTP请求发送XML作为参数,但原因是
dataUsingEncoding(NSUTF8StringEncoding)
我的请求字符串失败了。
这是我的代码:
let xmlRequest = "<?xml version="1.0" encoding="utf-8" standalone="no"?>
<response operation="getAccounts" handler="aphena">
<Id>11536502</Id>
<getAccountsParameters>
<client>654</client>
</getAccountsParameters>
</response>"
let requestXmlData = xmlRequest.dataUsingEncoding(NSUTF8StringEncoding)
let url = NSURL(string:"http://115.70.40.118:5800/mobile_bank/api")!
let request = NSMutableURLRequest(URL: url)
request.HTTPMethod = "POST"
request.HTTPBody = requestXmlData!
在服务器中我得到了这个鳕鱼:
<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"no\"?>\n<response operation=\"getAccounts\" handler=\"aphena\">\n\t<Id>11536502</Id>\n\t<getAccountsParameters>\n\t\t<client>654</client>\n\t</getAccountsParameters>\n</response>
我该如何解决这个问题?