Exemplo n.º 1
0
        protected string parseResponse(HttpWebResponse response)
        {
            if (response == null)
                return "";

            string result = null;

            // Examine the response status
            TLog.i(TAG, "Response status : {0}", response.StatusDescription);

            // Get hold of the response entity
            HttpEntity entity = response.getEntity();
            // If the response does not enclose an entity, there is no need
            // to worry about connection release

            if (entity != null) {

                try {
                    InputStream instream;

                    instream = entity.getContent();

                    result = convertStreamTostring(instream);

                    TLog.i(TAG, "Received : {0}", result);

                    // Closing the input stream will trigger connection release
                    instream.Close();

                } catch (IllegalStateException e) {
                    // TODO Auto-generated catch block
                    e.PrintStackTrace();
                } catch (IOException e) {
                    // TODO Auto-generated catch block
                    e.PrintStackTrace();
                }
            }

            return result;
        }