How do I post an XML request to a URL using HTTP POST and retrieve the response?
Update Sorry, my question was not clear I guess. I want to know how to post an XML request to an URL using either HttpClient or URLConnection and get the response as a POST parameter and display it in a webpage.
Use
InputStreamEntity
. I used httpclient 4.2.1.For example:
Warning this code is 5+ years old. I did some modfying for this post and never tested it. Hopefully it helps.
Post XML (data) to a server and downlod the resp:
Somewhere else.....
This example post an xml file, it depends on Jakarta HttpClient API (jakarta.apache.org)
Here's an example how to do it with
java.net.URLConnection
: