Hi All,

I am using 4x APIs. Here is my code

=========================

                String baseServer = "http://localhost:8080";;

                String serverUrl = baseServer + Some API URL;
                String signature = genSig.getSignature();

                HttpClient httpclient = new DefaultHttpClient();

                HttpPost httppost = new HttpPost(serverUrl);
                httppost.setHeader(Sets the header);

                File file = new File("data/userRegister.xml");

                InputStreamEntity reqEntity = new InputStreamEntity(
                                new FileInputStream(file), -1);
                reqEntity.setContentType("application/xml");
                reqEntity.setChunked(true);

                httppost.setEntity(reqEntity);

                System.out.println("executing request " +
httppost.getRequestLine());
                HttpResponse response = httpclient.execute(httppost); /*
THIS CODE WORKS FINE - I see the REQUEST in the backend */

/* Problem is I am not able to capture the response using following code.
What do I need to do? */


                HttpEntity resEntity = response.getEntity();

                
                System.out.println("Status : " + response.getStatusLine());
                
                if (resEntity != null) {
                        System.out.println("Response content length: "
                                        + resEntity.getContentLength());
/* I always get this as -1*/
                        System.out.println("Chunked?: " +
resEntity.isChunked());
                }

                if (resEntity != null) {
                        resEntity.consumeContent();
                }
    
===============================

I need to print the response that I get from the above method. How do I do
that?

Regards
Ajay




---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to