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
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!


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

When i debugged using Eclipse, this exception is thrown on this statement, 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 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


public Vector getWebData(String count)
   Vector personsVectorto = new Vector();
    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;
       , 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());
    	}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;

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