I want to pass xml to rest web service with request. I am unable to get how I can do this.
thanks in advance.
If you need a code sample:
String response = null;
httppost = new HttpPost(URL_STRING);
httppost.setParams(httpParams);
String s = your_XML_Data_As_String_Or_JSON_Or_Whatever;
try {
StringEntity entity = new StringEntity(s);
httppost.setEntity(entity);
httppost.addHeader("Content-Type", "SomeMIMEType");
response = httpclient.execute(httppost, handler);
} catch (Exception e){
e.printStackTrace }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With