×

Discussion Board

Results 1 to 4 of 4
  1. #1
    Registered User
    Join Date
    Jan 2010
    Posts
    13

    Question When I try to get data from web server,the emulator's http status code is 411

    Hi guys,
    I have a problem when I try to get data from web server in my Mobile Java application,the http status code I get is 411,so I get no data to use.
    However,the same application works well on Sun Emulator:the http status code is 200,and I get the data from web server.
    What's wrong with it?Is there anything else I not set before using the S60 emulator?
    My SDK is nS60_jme_sdk_3rd_e_FP1,my WTK is sun_java_wireless_toolkit-2_5_2-ml-windows,my IDE is eclipse-jee-galileo-SR1-win32.
    Regards,
    Defonds

  2. #2
    Super Contributor
    Join Date
    Jun 2003
    Location
    Cheshire, UK
    Posts
    7,395

    Re: When I try to get data from web server,the emulator's http status code is 411

    411 is "length required", which suggests you are POSTing data, but there is no content-length. This is unusual, as the implementation usually adds this. You could add it manually, but this is usually unnecessary.

    Are you POSTing to the server?

    Are you writing data to the HttpConnection's OutputStream?

    Graham.

  3. #3
    Registered User
    Join Date
    Jan 2010
    Posts
    13

    Re: When I try to get data from web server,the emulator's http status code is 411

    to Graham,
    Thank you for your replying,sir.
    Yes,I am posting to the server,this is my Mobile Java code:
    PHP Code:
                String _url url cmnet ? ("http://" host path) : ("http://10.0.0.172:80" path);
                
    System.out.println("The sending address is:" url);

                
    http = (HttpConnectionConnector.open(_urlConnector.READtrue);
                if (
    cmwap) {
                    
    http.setRequestProperty("X-Online-Host"host);
                }
                
    http.setRequestMethod(HttpConnection.POST);
                
    String contentType http.getHeaderField("Content-Type"); 
    But I just want to get some data from the server,so I have not written data to The HttpConnection's OutputStream.
    If my Java code is wrong,why its jar app works well on Sun Emulator,it even works well on N97 real handset.
    I mean is there anything I forgot to set on the S60 emulator,this makes the http status code 411 problem.
    Regards,
    Defonds.

  4. #4
    Registered User
    Join Date
    Jan 2010
    Posts
    13

    Re: When I try to get data from web server,the emulator's http status code is 411

    Hi,everyone,
    The problem has been solved.
    Just set request method from post to get:
    PHP Code:
                http.setRequestMethod(HttpConnection.GET);
                
    String contentType http.getHeaderField("Content-Type"); 
    Then the emulator of S60 goes well.
    Thank you all.
    Defonds.

Similar Threads

  1. Sending Huge data through GPRS (HTTP Post)
    By mockba in forum Symbian
    Replies: 4
    Last Post: 2008-05-19, 16:33
  2. suckho, i have encontered the same problems. Could you tell me how you resolved it?
    By dicson_hu in forum Symbian Networking & Messaging (Closed)
    Replies: 4
    Last Post: 2005-12-09, 10:56
  3. GPRS connection problems on 6600..
    By suckho in forum Symbian Networking & Messaging (Closed)
    Replies: 10
    Last Post: 2005-12-02, 14:00

Posting Permissions

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