×

Discussion Board

Results 1 to 6 of 6
  1. #1
    Registered User
    Join Date
    May 2008
    Posts
    7

    HTTP-CORE 0 happens when the user send post request for the sencond time

    hi, there is a problem when i use http to post data,
    the first time, after sending post request, everything goes well, but the second time,it fail with HTTP-CORE 0,
    i check the document which said it is caused "RHTTPSession session is already open".
    but i have no idea where goes wrong,

    i use the codes from the example, Anyone who knows the answer please figure it out, thanks deeply!!!

    the SetupConnectionL() function is as following:

    {

    TInt bearerFilter = EApBearerTypeAllBearers;
    TInt currentProfileId;

    // Check whether we are offline or online
    iRepository->Get(KProEngActiveProfile, currentProfileId);

    // Close the connection only if
    // a) this is not the first time and
    // b) the profile has changed and
    // c) either the previous or the current profile is Offline (5 = Offline)
    if (iPrevProfileId != -1 && iPrevProfileId != currentProfileId &&
    (iPrevProfileId == 5 || currentProfileId == 5))
    {
    // Close and uninitialize
    iConnectionDone = EFalse;
    iSession.Close();
    iConnection.Close();
    iSocketServ.Close();
    }

    // Save current profile id
    iPrevProfileId = currentProfileId;

    // Try to find an existing connection. If connection has not been set up,
    // iConnection is not initialized and FindExistingConnection() fails.
    // Thus, in that case, finding must not be carried out.
    if (iConnectionDone && !FindExistingConnection())
    {
    iConnectionDone = EFalse;
    }

    if (iConnectionDone)
    {
    // Connection setup is done
    return;
    }

    // Open RHTTPSession with default protocol ("HTTP/TCP")
    iSession.OpenL();

    // Install this class as the callback for authentication requests. When
    // page requires authentication the framework calls GetCredentialsL to get
    // user name and password.

    //InstallAuthenticationL(iSession);
    /*
    // In offline, only WLAN connections are available
    if (currentProfileId == 5)
    {
    bearerFilter = EApBearerTypeWLAN;
    }
    */
    // Show IAP selection dialog
    /*CActiveApDb* aDb = CActiveApDb::NewL();
    CleanupStack::PushL(aDb);

    CApSettingsHandler* settings = CApSettingsHandler::NewLC(
    *aDb,
    ETrue,
    EApSettingsSelListIsPopUp,
    EApSettingsSelMenuSelectNormal,
    KEApIspTypeAll,
    bearerFilter,
    KEApSortNameAscending,
    0,
    EVpnFilterBoth,
    ETrue);

    TInt iapRet = settings->RunSettingsL(0, iSelectedIap);
    CleanupStack::PopAndDestroy(settings);
    CleanupStack::PopAndDestroy(aDb);
    if (iapRet != KApUiEventSelected)
    {
    // Exit no selection
    User::Leave(KErrNotReady);
    }
    else*/
    {
    // IAP Selected
    // Open socket server and start the connection
    User::LeaveIfError(iSocketServ.Connect());
    User::LeaveIfError(iConnection.Open(iSocketServ));
    // Now we have the iap Id. Use it to connect for the connection
    TCommDbConnPref connectPref;
    // Setup preferences
    connectPref.SetDialogPreference(ECommDbDialogPrefDoNotPrompt);
    // Sets the CommDb ID of the IAP to use for this connection
    connectPref.SetIapId(iSelectedIap);
    // Start connection
    User::LeaveIfError(iConnection.Start(connectPref));
    // Set the sessions connection info...
    RStringPool strPool = iSession.StringPool();
    RHTTPConnectionInfo connInfo = iSession.ConnectionInfo();
    // ...to use our socket server and connection
    connInfo.SetPropertyL ( strPool.StringF(HTTP::EHttpSocketServ,
    RHTTPSession::GetTable() ), THTTPHdrVal (iSocketServ.Handle()) );
    // ...to use our connection
    connInfo.SetPropertyL ( strPool.StringF(HTTP::EHttpSocketConnection,
    RHTTPSession::GetTable() ),
    THTTPHdrVal (REINTERPRET_CAST(TInt, &(iConnection))) );

    iConnectionDone = ETrue;
    }

    }

  2. #2
    Nokia Developer Expert
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,143

    Re: HTTP-CORE 0 happens when the user send post request for the sencond time

    Maybe you should close the session before attempting to re-connect it. Also I wonder why you are checking the offline profile in there ?

  3. #3
    Registered User
    Join Date
    May 2008
    Posts
    7

    Re: HTTP-CORE 0 happens when the user send post request for the sencond time

    Yeah, thanks deeply, i just close all the connections before open again, the change as following:

    if (iPrevProfileId != -1 || iPrevProfileId != currentProfileId ||/*&&*/
    (iPrevProfileId == 5 || currentProfileId == 5))
    {
    // Close and uninitialize
    iConnectionDone = EFalse;
    iSession.Close();
    iConnection.Close();
    iSocketServ.Close();
    }


    change as:

    iConnectionDone = EFalse;
    iSession.Close();
    iConnection.Close();
    iSocketServ.Close();


    then, it is okay now!

    anyway, thanks deeply!!!

    Quote Originally Posted by symbianyucca View Post
    Maybe you should close the session before attempting to re-connect it. Also I wonder why you are checking the offline profile in there ?

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

    Re: HTTP-CORE 0 happens when the user send post request for the sencond time

    Quote Originally Posted by okcry@163.com View Post
    Yeah, thanks deeply, i just close all the connections before open again, the change as following:

    if (iPrevProfileId != -1 || iPrevProfileId != currentProfileId ||/*&&*/
    (iPrevProfileId == 5 || currentProfileId == 5))
    {
    // Close and uninitialize
    iConnectionDone = EFalse;
    iSession.Close();
    iConnection.Close();
    iSocketServ.Close();
    }


    change as:

    iConnectionDone = EFalse;
    iSession.Close();
    iConnection.Close();
    iSocketServ.Close();


    then, it is okay now!

    anyway, thanks deeply!!!

    Hi I am facing the same Problem..can u Kindly explain me how u solved...i did the changes as u mentioned but still getting the same problem.

  5. #5
    Regular Contributor
    Join Date
    Oct 2004
    Posts
    321

    Question Re: HTTP-CORE 0 happens when the user send post request for the sencond time

    Hi,

    I am facing same problem with get also.

    I debugged into the code and found that,FindExistingConnection() fails to identify that there is already a connection established.

    and hence "connected" variable is returned with EFalse,

    and then iSession.OpenL() crashes.

    now my question is why we need to call FindExistingConnection() function?

    the 2.2 example of http dont use FindExistingConnection() and instead just checks for iConnectionSetupDone flag

    can anybody help in solving this confusion.

    regards
    vinayak

  6. #6
    Regular Contributor
    Join Date
    May 2009
    Posts
    201

    Re: HTTP-CORE 0 happens when the user send post request for the sencond time

    Thanks yaar you helped me out
    nice answer yucca

Similar Threads

  1. how to send xml content over http post method
    By arayappan_it in forum Symbian Networking & Messaging (Closed)
    Replies: 10
    Last Post: 2011-03-25, 06:55
  2. http post request via socket connection
    By alliance205 in forum Mobile Java Networking & Messaging & Security
    Replies: 3
    Last Post: 2007-06-29, 11:25
  3. Problems with http - POST
    By bigbadwolf in forum Symbian Networking & Messaging (Closed)
    Replies: 13
    Last Post: 2007-01-17, 23:45
  4. Http Post (Time Out Error )
    By Mdhaval in forum Symbian C++
    Replies: 0
    Last Post: 2005-06-09, 15:12
  5. Does Vodafone UK wap gateway supports HTTP POST?
    By jessicay in forum Mobile Java Networking & Messaging & Security
    Replies: 2
    Last Post: 2004-07-06, 15:27

Posting Permissions

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