Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Finally I got it How to glue the code shown in above answer ...</p> <pre><code>public static void performPost(String getUri, String xml) { String serverName = "*******"; String username = "*******"; String password = "********"; String strResponse = null; try { HttpHost targetHost = new HttpHost(serverName, 443, "https"); DefaultHttpClient httpclient = new DefaultHttpClient(); try { // Store the user login httpclient.getCredentialsProvider().setCredentials( new AuthScope(targetHost.getHostName(), targetHost.getPort()), new UsernamePasswordCredentials(username, password)); // Create AuthCache instance AuthCache authCache = new BasicAuthCache(); // Generate BASIC scheme object and add it to the local // auth cache BasicScheme basicAuth = new BasicScheme(); authCache.put(targetHost, basicAuth); // Add AuthCache to the execution context BasicHttpContext localcontext = new BasicHttpContext(); localcontext.setAttribute(ClientContext.AUTH_CACHE, authCache); // Create request // You can also use the full URI http://www.google.com/ HttpPost httppost = new HttpPost(getUri); StringEntity se = new StringEntity(xml,HTTP.UTF_8); se.setContentType("text/xml"); httppost.setEntity(se); // Execute request HttpResponse response = httpclient.execute(targetHost, httppost, localcontext); HttpEntity entity = response.getEntity(); strResponse = EntityUtils.toString(entity); StatusLine statusLine = response.getStatusLine(); Log.i(TAG +": Post","statusLine : "+ statusLine.toString()); Log.i(TAG +": Post","________**_________________________\n"+strResponse); Log.i(TAG +": Post","\n________**_________________________\n"); } finally { httpclient.getConnectionManager().shutdown(); } } catch (Exception e) { e.printStackTrace(); } } </code></pre> <p>One very important thing How your library should be arranged and which libraries you will required ... </p> <p><img src="https://i.stack.imgur.com/XNsDI.png" alt="enter image description here"> </p> <p>From <a href="http://hc.apache.org/httpcomponents-client-ga/httpclient-cache/dependencies.html" rel="nofollow noreferrer">Here</a> you will find this libraries.</p> <p>To add them in eclipse (Below Android sdk &lt; 16)... </p> <pre><code>Project properties -&gt; java build path -&gt; Libraries -&gt; Add external JARs </code></pre> <p>To arrange them in order in eclipse ...</p> <pre><code>Project properties -&gt; java build path -&gt; order and export </code></pre> <p>For above Android sdk >= 16 you will have to put these libraries into "libs" folder.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      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