×

Discussion Board

Results 1 to 1 of 1
  1. #1
    Registered User
    Join Date
    Oct 2008
    Posts
    1

    Exclamation [moved] Error in sending data from nokia emulator to servlet(server)

    Hi everybody

    I am now writing a program. In my program, I send the data(string,bytearray,string,string) from midlet to the servlet.

    When I use sun java wtk emulator to run my program, the data are properly send from the midlet to servlet. I mean my program is working properly.

    But when I use nokia series 40 5th edition FP 1 emulator on the same program, the data are send at a time and not send all and it show error 500.

    I mean here is my code

    PHP Code:
    DataInputStream in = new DataInputStream((InputStream)request.getInputStream());
           
    String status in.readUTF();
    //        String status ="DataSend";

    System.out.println(status " Status");
    if (
    status.equals("DataSend")){
                
    int tmp_size 33544;
                
    tmp_size in.readInt();
                
    byte[] data = new byte[tmp_size];
                
    in.readFully(data);
                
    String toPhone in.readUTF();
                
    String fromPhone in.readUTF();
                
    String timeStart in.readUTF();
                
    boolean isRead in.readBoolean();
                
    in.close();
                
    timeStart=now();
                
    ConnectToDB CToDB = new ConnectToDB();
                
    CToDB.openConnection();
                
    String result CToDB.insertAccount(toPhonefromPhonedatatimeStartisRead);
                
    CToDB.closeConnection();
                
    System.out.println(data.length " after saving " result);
                    
    // SAVE condition
                    
    response.setContentType("text/plain");
                    
    response.setContentLength(result.length());

                    
    ServletOutputStream dos null;
                    
    dos = (ServletOutputStreamresponse.getOutputStream();
                    
    dos.write(result.getBytes());
                    
    dos.flush();
                    
    dos.close(); 
    At there ,the code "String status = in.readUTF();" is working and at here "tmp_size = in.readInt();" show error 500.

    So, I comment on "String status = in.readUTF();" and test again. At this time, it shows error on "in.readFully(data);".

    So , I think I can send the data per one time to the servlet.

    I use the same program and I don't change any coding, I only change the emulator.
    Sending data from servlet to midlet is no prblem because I only send back only one data.
    here is my code :
    PHP Code:
     ServletOutputStream dos null;
                    
    dos = (ServletOutputStreamresponse.getOutputStream();
                    
    dos.write(voice_data);
                    
    dos.flush();
                    
    dos.close(); 
    Please tell me my coding is wrong or it is a bug on the nokia emulator. I need to finalize my program.

    And another problem is if I use the Apache Tomcat server(I deploy my war file on Tomcat), it shows above error using the nokia emulator.

    On the other hand, if I use the Glass Fish server(I deploy my war file on Glass Fish), it shows the server not found error (404) using nokia emulator.

    If I use sun java wtk emulator on the same program,the sun java emulator can link and work properly to the Tomcat server and Glass Fish server.

    I must deploy my war file on the real working glass fish server and I must test my program on the Nokia 6500s-1. So I need to finish my program.

    Please help me how can i solve above bug.

    PS: I use the Netbean IDE 6.1 and use nokia series 40 5th edition emulator and sun java wtk 2.5.2 emultor

    Please could anyone who has the same experience share me the solution!

    Thanks you everybody
    With regards
    Last edited by icecubebar; 2008-10-09 at 12:29. Reason: I think incomplete

Similar Threads

  1. Nokia Mobile VPN Client
    By marcyl in forum Symbian Networking & Messaging (Closed)
    Replies: 1
    Last Post: 2003-12-01, 14:47
  2. Http connection problem in 6310i
    By teahola in forum Mobile Java General
    Replies: 1
    Last Post: 2002-10-03, 18:46

Posting Permissions

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