I am new to Android as well as webservices. I have never used post webservice. Tried as below but it is neither showing success nor failure.
If I use the advanced rest client chrome extension, I am able to test and webservice is working perfectly just that it takes much time.
When trying to run from code, it immediately shows - after calling webservices - toast msg --> indicates it did not call the webservice.
Spent 2 days in it but no luck. Any suggestions?
 public void borrowBook(String barCode, String patronId)
    {
        final int DEFAULT_TIMEOUT = 200000 * 1000000000;
        // Make RESTful webservice call using AsyncHttpClient object
        AsyncHttpClient client = new AsyncHttpClient();
        client.setTimeout(DEFAULT_TIMEOUT);
        progress.setMessage("Please Wait...");
        progress.setIndeterminate(false);
        progress.setCancelable(false);
        progress.show();
        RequestParams params = new RequestParams();
        Toast.makeText(getActivity().getApplicationContext(), "B4 calling webservice", Toast.LENGTH_LONG).show();
        client.post("http://43.555.6.111:8081/SIPServices/SIc.svc/Checkout?barcode=B12&patron=thi", new TextHttpResponseHandler() {
                    @Override
                    public void onSuccess(int i, Header[] headers, String response) {
                        Toast.makeText(getActivity().getApplicationContext(), "Response: " + response, Toast.LENGTH_LONG).show();
                        Log.d("TAG", "Success");
                    }
                    @Override
                    public void onFailure(int statusCode, Header[] headers, String response, Throwable error) {
                        Toast.makeText(getActivity().getApplicationContext(), "Status code :" + statusCode + "errmsg : " + error.getMessage(), Toast.LENGTH_LONG).show();
                        Toast.makeText(getActivity().getApplicationContext(), "Unexpected Error occcured! [Most common Error: Device might not be connected to Internet or remote server is not up and running]", Toast.LENGTH_LONG).show();
                        Log.d("TAG", "Failure");
                    }
                }
        );
        progress.dismiss();
        Toast.makeText(getActivity().getApplicationContext(), "After calling webservice", Toast.LENGTH_LONG).show();
    }
 
     
    