Note that there are some explanatory texts on larger screens.

plurals
  1. POAndroid, sending XML via HTTP POST (SOAP)
    primarykey
    data
    text
    <p>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.</p> <pre class="lang-java prettyprint-override"><code>public void postData() { // Create a new HttpClient and Post Header HttpClient httpclient = new DefaultHttpClient(); HttpPost httppost = new HttpPost("http://10.10.4.35:53011/"); try { // Add your data List&lt;NameValuePair&gt; nameValuePairs = new ArrayList&lt;NameValuePair&gt;(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 } } </code></pre> <p>This is the complete POST message that i need to imitate:</p> <pre><code>POST /a8103e90-f1e3-11dd-bfdb-8b1fcff1a110 HTTP/1.1 Host: 10.10.4.35:53011 Content-Type: application/soap+xml Content-Length: 602 &lt;?xml version='1.0' encoding='UTF-8' ?&gt; &lt;s12:Envelope xmlns:s12="http://www.w3.org/2003/05/soap-envelope" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing"&gt; &lt;s12:Header&gt; &lt;wsa:MessageID&gt;urn:uuid:fc061d40-3d63-11df-bfba-62764ccc0e48&lt;/wsa:MessageID&gt; &lt;wsa:Action&gt;http://schemas.xmlsoap.org/ws/2004/09/transfer/Get&lt;/wsa:Action&gt; &lt;wsa:To&gt;urn:uuid:a8103e90-f1e3-11dd-bfdb-8b1fcff1a110&lt;/wsa:To&gt; &lt;wsa:ReplyTo&gt; &lt;wsa:Address&gt;http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous&lt;/wsa:Address&gt; &lt;/wsa:ReplyTo&gt; &lt;/s12:Header&gt; &lt;s12:Body /&gt; &lt;/s12:Envelope&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload