Organizational Research By

Surprising Reserch Topic

Android, sending XML via HTTP POST (SOAP)

I would like to invoke a webservice via Android. I need to POST some XML to a URL via HTTP. I found this snipped for sending a POST, but i dont know how to include/add the XML data itself.

public void postData() {
         // Create a new HttpClient and Post Header  
         HttpClient httpclient = new DefaultHttpClient();  
         HttpPost httppost = new HttpPost("");

         try {  
             // Add your data  
             List nameValuePairs = new ArrayList(2);  
             nameValuePairs.add(new BasicNameValuePair("Content-Type", "application/soap+xml"));               
             httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs));
                 // Where/how to add the XML data?

             // Execute HTTP Post Request  
             HttpResponse response = httpclient.execute(httppost);  

         } catch (ClientProtocolException e) {  
             // TODO Auto-generated catch block  
         } catch (IOException e) {  
             // TODO Auto-generated catch block  
This is the complete POST message that i need to imitate:

POST /a8103e90-f1e3-11dd-bfdb-8b1fcff1a110 HTTP/1.1
Content-Type: application/soap+xml
Content-Length: 602" xmlns:wsa="" rel="nofollow" target="_blank">">



asked May 1, 2015 in ANDROID by rajesh
0 votes

Related Hot Questions

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
Anti-spam verification:
To avoid this verification in future, please log in or register.