×

Discussion Board

Results 1 to 15 of 15
  1. #1
    Regular Contributor
    Join Date
    Jan 2009
    Posts
    264

    Smile String returns null when more data is copied

    Hi All
    Greeting for the day,

    I am connecting to a webservice which returns me data in String format. The data returned can be 20,000 chars or more in volume. If i test it in Emulator then i get data successfully But when i test it on Nokia E72 device. It returns null.

    Earlier when i was testing with less data it was working fine.

    Please help me how can i overcome it.
    Thanks & Regards
    Gaurav Gupta

  2. #2
    Super Contributor
    Join Date
    Mar 2008
    Location
    The Capital of INDIA
    Posts
    4,328

    Re: String returns null when more data is copied

    Is the web service sending the data?
    did you check this , when you hit the server using the device right now, server send the data?
    Are you sure that the data is just null right now and this is not lesser in the volume?
    Last edited by raj_J2ME; 2010-06-01 at 07:41.
    Thanks with Regards,

    R a j - The K e r n e l


    Join Delhi-NCR Nokia Developer's Community,

  3. #3
    Nokia Developer Expert
    Join Date
    Aug 2007
    Posts
    1,595

    Re: String returns null when more data is copied

    Earlier when i was testing with less data it was working fine.
    How much less?

    Regards,
    r2j7
    [URL="http://library.forum.nokia.com/java"][B] >>> Java Developer's Library <<<[/B][/URL]
    [URL="https://www.developer.nokia.com/Resources/Support/Technical_support.xhtml"] [B]>>> Technical Support for Java ME development <<<[/B][/URL]
    [URL="https://publish.ovi.com/info/"][B]>>> Nokia Publish: reach millions of Nokia users worldwide through Nokia Store <<<[/B][/URL]

  4. #4
    Regular Contributor
    Join Date
    Jan 2009
    Posts
    264

    Re: String returns null when more data is copied

    Quote Originally Posted by r2j7 View Post
    How much less?

    Regards,
    r2j7
    It was some what 15,000 characters.
    Thanks & Regards
    Gaurav Gupta

  5. #5
    Regular Contributor
    Join Date
    Jan 2009
    Posts
    264

    Re: String returns null when more data is copied

    Quote Originally Posted by raj_J2ME View Post
    Is the web service sending the data?
    did you check this , when you hit the server using the device right now, server send the data?
    Are you sure that the data is just null right now and this is not lesser in the volume?
    Yes sir it is sending data and i have tested it in emulator and i am able to view that data in emulator.But when i run the same code on device it returns null . i am appending it on form

    When i am testing it with less data it works fine.
    Actually i request some data from the webservice based on my request the webservice returns the data . now i am requesting less data from webservice. Please suggest me some solution


    Let me tell you the scenario

    Code:
     String response=service.execute(stringToSend);
                println(response);  appends null to form.
    
    
    public void println(String s) {
            form.append(s + "\n");
        }
    Thanks & Regards
    Gaurav Gupta

  6. #6
    Super Contributor
    Join Date
    Mar 2008
    Location
    The Capital of INDIA
    Posts
    4,328

    Re: String returns null when more data is copied

    Quote Originally Posted by gaurav.gupta View Post
    1.Yes sir it is sending data and i have tested it in emulator and i am able to view that data in emulator.

    2.But when i run the same code on device it returns null . i am appending it on form
    [COLOR="Green"]
    1. That ok, means the server is sending the data. and hence you able to append the same in the form on the client.This is the case of the emulator..

    2.In case of the real device you are executing the same app, and your are getting the null values, when you are appending the response on the form...

    Now my questions :-

    @ Was the server really called by the real device?
    @ Was the server able to handle and process the request of the device client?
    @ Was the server able to write the data to the client?
    Thanks with Regards,

    R a j - The K e r n e l


    Join Delhi-NCR Nokia Developer's Community,

  7. #7
    Regular Contributor
    Join Date
    Jan 2009
    Posts
    264

    Re: String returns null when more data is copied

    @ raj

    @ Was the server really called by the real device? Yes
    @ Was the server able to handle and process the request of the device client? Yes
    @ Was the server able to write the data to the client? Server is sending data but data is not being captured in string

    Server is working fine and it sending data.
    More over Let me tell you there are some 25 categories in which i have to fetch data from server.
    If i fetch all categories in one step data is being sent from server but i dont know why it is NULL when printed on form in case of real device.
    But if i fetch less categories let say 10 it appends data to form.
    Thanks & Regards
    Gaurav Gupta

  8. #8
    Super Contributor
    Join Date
    Mar 2008
    Location
    The Capital of INDIA
    Posts
    4,328

    Re: String returns null when more data is copied

    Which method of data communication are you using?
    How are you reading the data and what is the size of the data that you are receiving when server is sending
    categories?
    May the data is going to lost on the client side, how are you storing the data?
    Thanks with Regards,

    R a j - The K e r n e l


    Join Delhi-NCR Nokia Developer's Community,

  9. #9
    Regular Contributor
    Join Date
    Jan 2009
    Posts
    264

    Re: String returns null when more data is copied

    Quote Originally Posted by raj_J2ME View Post
    Which method of data communication are you using?
    How are you reading the data and what is the size of the data that you are receiving when server is sending
    categories?
    May the data is going to lost on the client side, how are you storing the data?


    The web service is made in .net and i have created a stub to connect and call its execute method which takes a string argument and returns a String.

    I store data in RecordStore but the point is that i am not receving it despite of webservice sending it everytime.
    What could be the reason when less data is sent it is captured and when large amount of data is sent it doesnot.

    One more thing if data is not coming it should also not come in emulator. What i feel is String object is not able to hold large amount of data.
    Thanks & Regards
    Gaurav Gupta

  10. #10
    Super Contributor
    Join Date
    Mar 2008
    Location
    The Capital of INDIA
    Posts
    4,328

    Re: String returns null when more data is copied

    That's why I asked you in my last post.Kindly try to store the data in buffer or vector rather than the string.Then check the app, whether this can receive the total amount of data or not?
    Thanks with Regards,

    R a j - The K e r n e l


    Join Delhi-NCR Nokia Developer's Community,

  11. #11
    Regular Contributor
    Join Date
    Jan 2009
    Posts
    264

    Re: String returns null when more data is copied

    Quote Originally Posted by raj_J2ME View Post
    That's why I asked you in my last post.Kindly try to store the data in buffer or vector rather than the string.Then check the app, whether this can receive the total amount of data or not?
    Ok Sir

    According to you i should use Streams.
    Thanks & Regards
    Gaurav Gupta

  12. #12
    Super Contributor
    Join Date
    Mar 2008
    Location
    The Capital of INDIA
    Posts
    4,328

    Re: String returns null when more data is copied

    Even currently you must be reading the data using the same..is'n it?

    You keep on adding the data in the vector or buffer..
    Thanks with Regards,

    R a j - The K e r n e l


    Join Delhi-NCR Nokia Developer's Community,

  13. #13
    Regular Contributor
    Join Date
    Jan 2009
    Posts
    264

    Re: String returns null when more data is copied

    Quote Originally Posted by raj_J2ME View Post
    Even currently you must be reading the data using the same..is'n it?

    You keep on adding the data in the vector or buffer..
    Actually i was doing like following

    Code:
    String response=service.execute(strToSend);
    now i tried
    Code:
    StringBuffer bfrStr=null;
                byte[] arrBytes=service.execute(stringToSend).getBytes();
                
                if(arrBytes.length>0)
                {
                    bfrStr=new StringBuffer(arrBytes.length);
                    for(int i=0;i<arrBytes.length;i++)
                    {
                        char c=(char)arrBytes[i];
                        bfrStr.append(c);
                    }
                }
                
                if(bfrStr!=null)
                {
                println(bfrStr.toString());
                getResponse(bfrStr.toString());
                }
    Now i am getting arrayIndexOutofBoundsException.

    I think of using StreamReader will it be the right approach ?..
    Thanks & Regards
    Gaurav Gupta

  14. #14
    Super Contributor
    Join Date
    Mar 2008
    Location
    The Capital of INDIA
    Posts
    4,328

    Re: String returns null when more data is copied

    Where this is about..client or server?
    Thanks with Regards,

    R a j - The K e r n e l


    Join Delhi-NCR Nokia Developer's Community,

  15. #15
    Registered User
    Join Date
    May 2010
    Posts
    214

    Re: String returns null when more data is copied

    Can anyone tell me how to add LWUIT to netbeans 6.8 ..........I have downloaded LWUIT from the official java website.........

Similar Threads

  1. Accessing accelerometer data gradually increases CPU load
    By Larry101 in forum Mobile Java General
    Replies: 2
    Last Post: 2010-09-09, 21:35
  2. HttpConnection is not working
    By sujit.dhali in forum Mobile Java Networking & Messaging & Security
    Replies: 15
    Last Post: 2009-08-25, 15:52
  3. Encrypt and Encode into writable format! HEEELP...
    By sandro1972 in forum Mobile Java General
    Replies: 6
    Last Post: 2007-04-16, 06:36
  4. Problem with HTTP POST
    By thathoo in forum Mobile Java General
    Replies: 2
    Last Post: 2006-12-18, 18:23
  5. Personal
    By JSmith77 in forum PersonalJava
    Replies: 4
    Last Post: 2003-07-30, 12:52

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •