BlackBerry Forums Support Community
              

Closed Thread
 
LinkBack Thread Tools
Old 03-26-2009, 12:59 PM   #1 (permalink)
New Member
 
Join Date: Mar 2009
Model: Bold
PIN: N/A
Carrier: Rogers
Posts: 5
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default Exception while consuming huge data from a web service.

Please Login to Remove!

Hi,

I m developing an app to receive data from a Web Service and persist the received data on the device.

App is Developed for OS 4.3.0

The Web Service call is done using Ksoap. The Code receives the data from the web service , parses the data and stores it in an object . This object is then persisted on the device. The Data is essentially contact information . It takes the no of contacts requried as input and passes it to the Web Service. The Web Service then returns the asked number of records

The code works if i request data of upto ~600 records. If i specify more than 600 records, it throws the following exception

String :org.xmlpull.v1.XmlPullParserException:unexpected type ( position:TEXT Request Entity in T...@1:24 in java.io.InputStreamReader@1f87d1b4)

When i debugged using Eclipse, this exception is thrown on this statement ht.call(soapAction, envelope);

Could this be because of a timeout? Ot is it because the parser is not able to parse huge data?

Since this exception occurs on the ht.call statement, i assume that that the problem is with the web service call and not with the code for persistent storage.


I have included the code here.. Could anyone please show me what is wrong ?

Code for the Web Services Call

Code:

public Vector getWebData(String count)
    {
    	
   Vector personsVectorto = new Vector();
    try
    {
    StringBuffer receivedContent = new StringBuffer();
    String serviceUrl = ".........";
    String serviceNamespace = "...........";
   String soapAction = "..............";
  
   SoapObject rpc = new SoapObject(serviceNamespace, "GetContactsList");
        //rpc.addProperty("listSize", "5");
        rpc.addProperty("listSize", count);
     SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
        
        envelope.bodyOut = rpc;
        
        envelope.dotNet = true;
        envelope.encodingStyle = SoapSerializationEnvelope.XSD;
        HttpTransport ht = new HttpTransport(serviceUrl);
        ht.debug = true;
       
        
        ht.call(soapAction, envelope); // This is where thexmlpullparser exception occurs
        
 Object obj = envelope.getResponse();
        SoapObject soapResult = (SoapObject)obj;
           
        
        	for(int i=0; i < soapResult.getPropertyCount(); i++)
    
        	{
      	      PersonDTO personto = new PersonDTO();
           SoapObject choice = (SoapObject)soapResult.getProperty(i);
            if( choice!=null)
            {
                for(int j = 0; j < choice.getPropertyCount(); j++)
                {
              	  receivedContent.append(" Reading Property Number" + String.valueOf(j) + " Value = " + choice.getProperty(j).toString());
              	  
     if (j==0) personto.setElement(1,choice.getProperty(j).toString());
    if (j==1) personto.setElement(2,choice.getProperty(j).toString());
    if (j==2) personto.setElement(3,choice.getProperty(j).toString());
    if (j==3) personto.setElement(4,choice.getProperty(j).toString());
    if (j==4) personto.setElement(5,choice.getProperty(j).toString());
     if (j==5) personto.setElement(6,choice.getProperty(j).toString());
     if (j==6) personto.setElement(7,choice.getProperty(j).toString());
      if (j==7) personto.setElement(8,choice.getProperty(j).toString());
     if (j==8) personto.setElement(9,choice.getProperty(j).toString());
   if (j==9) personto.setElement(10,choice.getProperty(j).toString());
                }
            }            	  
  	      
            personsVectorto.addElement(personto);
            //storepersistentobject(personsVectorto);
        }
        
            
    	}catch(org.xmlpull.v1.XmlPullParserException ex2)
        {
    		String bah1 = ex2.toString();
            Dialog.alert("String: " + bah1); 
            String bah2 = ex2.getMessage();
            Dialog.alert("Message: " + bah2); 

       
        }    	
    	
    	catch(Exception ex){
            String bah = ex.toString();
            Dialog.alert("Response: " + bah);
            
        	
            }
           
            return personsVectorto;
    }
Offline  
Closed Thread


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

AT17LV002-10JC Atmel EEPROM
$8.99
AT17LV002-10JC Atmel EEPROM  pictureCH341 Programmer USB Interface EEPROM Reader for 24CXX Series New
$3.54
CH341 Programmer USB Interface EEPROM Reader for 24CXX Series New picture24LC02B/SN MICROCHIP IC EEPROM 2KBIT 8PIN SOIC 25 PIECES
$12.6
24LC02B/SN MICROCHIP IC EEPROM 2KBIT 8PIN SOIC 25 PIECES pictureEE TOOLS CHIPMAX DEVICE PROGRAMMER; PARALLEL PORT INTERFACE; 40 PIN - EEPROM
$20.0
EE TOOLS CHIPMAX DEVICE PROGRAMMER; PARALLEL PORT INTERFACE; 40 PIN - EEPROM pictureAT24C16B-TH-B ATMEL EEPROM 8-PIN ROHS 2 PIECES
$12.8
AT24C16B-TH-B ATMEL EEPROM 8-PIN ROHS 2 PIECES picture






Copyright 2004-2016 BlackBerryForums.com.
The names RIM and BlackBerry are registered Trademarks of BlackBerry Inc.