如何使用HTTP请求的Android为POST xml文件? [英] How to POST xml file using http request in Android?
问题描述
我想POST以下XML到服务器的URL,但我不知道该怎么去做。 GET请求是很容易的,但我在使用POST请求的问题。
&LT ;? XML版本= 1.0>
<请求>
< Elemtnt>
<数据ID =1> E1203&所述; /数据>
<数据的id =2> E1204&所述; /数据>
< /组件>
< /请求>
重新创建一个像这样的字符串:
字符串与myXML =< XML版本= 1.0><请求>< Elemtnt><数据ID = \1 \> E1203< /数据><数据ID = \ 2 \> E1204< /数据>< /组件>< /请求>中;
和使用相同字符串,在我的previous答案:<一href="http://stackoverflow.com/questions/7737610/how-to-attach-xml-file-in-message-body-of-http-post-request/7738506#7738506">How附加XML文件中的HTTP POST请求消息体?
I'm trying to POST the following xml to a server url, but i don't know how to go about it. GET requests are easy enough, but I'm having a problem with POST requests.
<? xml version=1.0>
<Request>
<Elemtnt>
<data id="1">E1203</data>
<data id="2">E1204</data>
</Element>
</Request>
Recreate a string like this:
String myXML = "<?xml version=1.0> <Request> <Elemtnt> <data id=\"1\">E1203</data> <data id=\"2\">E1204</data></Element></Request>";
and use the same string in my previous answer: How to attach XML file in message body of HTTP post request?
这篇关于如何使用HTTP请求的Android为POST xml文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!