tags:

views:

28

answers:

0

Hi,

I am sending xml through a HttpResponse from an aspx page(this part works) to my android client(this part works on emulator but not on device).

When using the android emulator, the full xml response comes through. But the moment I install it on a device (SE X10 or Archos 7 tablet) the response gets cut off at the same point on both devices.

How do I increase the response message size limit in my android code so that the full response comes through?

Please find attached the function we use to make the call to the server and to receive the response.

Kind Regards,

Renier

     public static Document ServerCallDomDoc(
       String call,
       Map<String, Object> parameters, 
       Context applicationContext) 
     {

  HttpClient httpclient = new DefaultHttpClient();  
  HttpPost httppost = new HttpPost(MainStore.getUrl());  

  try 
  {   
   List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(1);  

   //Add parameters
   String sPar = "";
   for (Entry<String, Object> x : parameters.entrySet())
   {
    sPar += x.getKey().toUpperCase() + "=" + x.getValue() + ";";
   }

   sPar = sPar.substring(0, sPar.length() - 1);   

   nameValuePairs.add(new BasicNameValuePair("par", call + ";" + sPar));   
   httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs));  

   // Execute HTTP Post Request  
   HttpResponse response = httpclient.execute(httppost);  


   //Get the xml from the response Entity's content
   HttpEntity ent = response.getEntity();
   InputStream is = ent.getContent();  
   byte[] b = new byte[(int)ent.getContentLength()];
   is.read(b);

   String strXML = new String(b);

   //Parse strXML into org.w3c.dom.Document
   DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory.newInstance();
      DocumentBuilder docBuilder = docBuilderFactory.newDocumentBuilder();

      StringReader reader = new StringReader(strXML);
      InputSource is2 = new InputSource(reader);

      org.w3c.dom.Document domDoc = docBuilder.parse(is2);

   return domDoc;

  } 
  catch (ClientProtocolException e) 
  {   
   Utilities.makeLongToast(e.toString(), applicationContext);
   return null;
  } 
  catch (IOException e) 
  {  
   Utilities.makeLongToast(e.toString(), applicationContext);
   return null;
  } 
  catch (SAXException e) 
  {  
   Utilities.makeLongToast(e.toString(), applicationContext);
   return null;
  } 
  catch (ParserConfigurationException e) 
  {  
   Utilities.makeLongToast(e.toString(), applicationContext);
   return null;
  }     
 }