Discussion Board

Results 1 to 11 of 11

Hybrid View

  1. #1
    Registered User
    Join Date
    Nov 2012
    Posts
    5

    Problem with Http Post

    Hi, I have problem posting some data (approximately 150KB) on Nokia Asha 1.1 SDK Simulator as well as on a real Asha 503 device. The same code works flawlessly on previous Asha phones and simulators. The problem is that it takes really long time to complete (approximately 3 minutes) . While debugging I found that the problem line is where the connection gets the response code (http.getResponseCode()). I checked the server if the request is received but there is no data reaching the server before these 3 minutes. For some reason the code execution stops at http.getResponseCode() for 2-3 minutes and I can't figure out why is that. Please check my code below and tell me if you have any clues. Thanks in advance.

    Code:
    http = (HttpConnection)Connector.open(URL);
    http.setRequestMethod(HttpConnection.POST);
    http.setRequestProperty("User-Agent", USER_AGENT);
    http.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
    
    out = http.openOutputStream();
    out.write(params.getBytes()); //params contain 139 783 bytes of data
    out.flush();
    if (http.getResponseCode() == HttpConnection.HTTP_OK) //here is the hang
    {
    	//do something with the response
    }

  2. #2
    Super Contributor
    Join Date
    Mar 2003
    Location
    Finland
    Posts
    9,570

    Re: Problem with Http Post

    Instead of single, huge HTTP POST, how about doing a multipart/chunked post (Transfer-Encoding: chunked)?

  3. #3
    Nokia Developer Champion
    Join Date
    Mar 2013
    Posts
    686

    Re: Problem with Http Post

    Just to make sure its not a network issue, can you check once on WIFI and another with operator connection?
    its just doesn't seem realistic that it would take 3 min even if its just 1 "huge" (150kb isn't huge at all) post, could there be a delay in the server execution?
    Heard of DVLUP? Join here

  4. #4
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,791

    Re: Problem with Http Post

    A thing you can also try is specifying a Content-Length header.

  5. #5
    Registered User
    Join Date
    Nov 2012
    Posts
    5

    Re: Problem with Http Post

    Thanks to all for the replies Setting Content-Length doesn't help. It's not operator problem because I test this on Simulator and on real device with 2 WiFi hotspots. I don't think 150 KB is huge amount of data even for phones like Asha 501/503. As I told this code run perfectly on previous Asha devices like 306/311.

    According to this post "HTTPConnection has a new implementation":
    http://developer.nokia.com/community...n-Asha-SDK-1-0

    Is it possible this is a bug in this "new implementation"?

  6. #6
    Super Contributor
    Join Date
    Apr 2007
    Posts
    2,708

    Re: Problem with Http Post

    Like wizard-hu was advising in that other discussion you might want to try to intercept the data with WireShark and see if you are getting a response right away from the server, and if so if the data is starting to flow right away...
    Note: please don't send private questions to me, as I don't have time to provide private support. All such questions should be posted on public forums, where I and others can see and answer them.

Similar Threads

  1. HTTP POST problem
    By rami75lu in forum Symbian Networking & Messaging (Closed)
    Replies: 0
    Last Post: 2010-10-21, 10:06
  2. HTTP post(ing) problem
    By sohan in forum Symbian Networking & Messaging (Closed)
    Replies: 1
    Last Post: 2007-03-28, 09:48
  3. http post problem
    By ceehira in forum Symbian
    Replies: 0
    Last Post: 2006-07-28, 13:49
  4. HTTP POST Problem with SDK's
    By tonyhabayeb in forum Mobile Java Networking & Messaging & Security
    Replies: 1
    Last Post: 2006-06-16, 13:41
  5. HTTP POST Problem
    By Rx-lee in forum Symbian Networking & Messaging (Closed)
    Replies: 3
    Last Post: 2006-05-30, 04:58

Posting Permissions

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