2

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>
Gensheriff
  • 395
  • 1
  • 5
  • 17

2 Answers2

3

This question has been answered many times on Stackoverflow.

Here: Android, sending XML via HTTP POST (SOAP)

and here: Android, send and receive XML via HTTP POST method

and here: Send xml files in android with http post

If you already do it this way, then post some of your code.

Community
  • 1
  • 1
Franziskus Karsunke
  • 4,948
  • 3
  • 40
  • 54
2

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?

Community
  • 1
  • 1
Paresh Mayani
  • 127,700
  • 71
  • 241
  • 295