Discussion Board

Results 1 to 2 of 2
  1. #1
    Registered User
    Join Date
    Feb 2008

    http posting issues while connecting through proxy settings

    Hi all,

    My application posting data to web server at specified interval of time, i tested my application for 2 different service provider connections. In one service provider gprs settings, there is no proxy settings(i.e proxy server ip and port is and 0 respectively), but for another service provider settings using proxy server and port number(for example server: and port:9001).

    The problem is my application working fine for non-proxy service provider, but the same sis file and same device giving "System error" for proxy enabled service provider connection.i can browse web sites for both service provider connection, only problem in symbian c++ application.

    here i pasted my http connection code:

    void CClientEngine::IssueHTTPPostL(const TDesC8& aUri,
    const TDesC8& aContentType, const TDesC8& aBody)
    SetupConnectionL ();

    delete iFormEncoder;
    iFormEncoder = NULL;
    iFormEncoder = CHTTPFormEncoder::NewL ();
    iFormEncoder->AddFieldL (_L8 ("Data"), aBody);

    TUriParser8 uri;
    uri.Parse (aUri);

    // Get request method string for HTTP POST
    RStringF method = iSession.StringPool().StringF (HTTP::EPOST, RHTTPSession::GetTable ());

    // Open transaction with previous method and parsed uri. This class will
    // receive transaction events in MHFRunL and MHFRunError.
    iTransaction = iSession.OpenTransactionL (uri, *this, method);

    // Set headers for request; user agent, accepted content type and body's
    // content type.
    RHTTPHeaders hdr = iTransaction.Request().GetHeaderCollection ();
    SetHeaderL (hdr, HTTP::EUserAgent, KUserAgent);
    SetHeaderL (hdr, HTTP::EAccept, KAccept);
    SetHeaderL (hdr, HTTP::EContentType, aContentType);

    iTransaction.Request().SetBody (*iFormEncoder);
    // Submit the transaction. After this the framework will give transaction
    // events via MHFRunL and MHFRunError.
    iTransaction.SubmitL ();

    iRunning = ETrue;


    void CClientEngine::SetupConnectionL()
    if ( iConnectionSetupDone)

    iConnectionSetupDone = ETrue;

    //open socket server and start the connection
    User::LeaveIfError (iSocketServ.Connect ());
    User::LeaveIfError (iConnection.Open (iSocketServ));

    // open the IAP communications database
    CCommsDatabase* commDB = CCommsDatabase::NewL (EDatabaseTypeIAP);
    CleanupStack::PushL (commDB);

    // initialize a view
    * commDBView =commDB->OpenConnectionPrefTableInRankOrderLC (ECommDbConnectionDirectionUnknown);

    // go to the first record
    User::LeaveIfError (commDBView->GotoFirstRecord ());

    // Declare a prefTableView Object.
    CCommsDbConnectionPrefTableView::TCommDbIapConnectionPref pref;

    // read the connection preferences
    commDBView->ReadConnectionPreferenceL (pref);
    TUint32 iapID = pref.iBearer.iIapId;

    // pop and destroy the IAP View
    CleanupStack::PopAndDestroy (commDBView);

    // pop and destroy the database object
    CleanupStack::PopAndDestroy (commDB);

    // Now we have the iap Id. Use it to connect for the connection.
    // Create a connection preference variable.
    TCommDbConnPref connectPref;

    // setup preferences
    connectPref.SetDialogPreference (ECommDbDialogPrefDoNotPrompt);
    connectPref.SetDirection (ECommDbConnectionDirectionUnknown);
    connectPref.SetBearerSet (ECommDbBearerGPRS);
    //Sets the CommDb ID of the IAP to use for this connection
    connectPref.SetIapId (iapID);

    User::LeaveIfError (iConnection.Start (connectPref));

    // ----------------------- Proxy setting begin ----------------------------------
    HBufC* serviceType = HBufC::NewL (KCommsDbSvrMaxFieldLength);
    CleanupStack::PushL (serviceType);
    TPtr serviceTypePtr = serviceType->Des ();

    User::LeaveIfError (iConnection.GetDesSetting (_L ("IAP\\IAPServiceType"),

    CleanupStack::Pop (serviceType);

    if ( UseProxy (iapID, serviceTypePtr))
    CHttpFilterProxyInterface::InstallFilterL (iSession);
    RHTTPConnectionInfo connInfo = iSession.ConnectionInfo ();
    connInfo.SetPropertyL (iSession.StringPool().StringF (HTTP::EHttpSocketServ, RHTTPSession::GetTable ()),
    THTTPHdrVal (iSocketServ.Handle ()));
    TInt connPtr = REINTERPRET_CAST (TInt, &iConnection);
    connInfo.SetPropertyL (iSession.StringPool().StringF (HTTP::EHttpSocketConnection, RHTTPSession::GetTable ()),
    THTTPHdrVal (connPtr));
    // ------------------------- Proxy settings end -------------------------------


    TBool CClientEngine::UseProxy(TUint32 aIapID, TDesC& aServiceType)
    // open commdb
    TBool iUseProxy;
    CCommsDatabase* commDb = CCommsDatabase::NewL (EDatabaseTypeIAP);
    CleanupStack::PushL (commDb);
    TBool proxyEnabled(EFalse);

    // opening the table
    CCommsDbTableView* commView = commDb->OpenViewOnProxyRecordLC (aIapID,

    if ( commView->GotoFirstRecord ()== KErrNone)
    // Read the flag to see if we need proxyEnabled.
    commView->ReadBoolL (TPtrC (PROXY_USE_PROXY_SERVER), proxyEnabled);

    if ( proxyEnabled)

    CleanupStack::PopAndDestroy (commView);
    CleanupStack::PopAndDestroy (commDb);

    return iUseProxy;

    please correct me if i am doing anything wrong.

  2. #2
    Registered User
    Join Date
    Feb 2008

    Re: http posting issues while connecting through proxy settings


    I tested one J2me application, it works fine on the same GPRS settings. why C++ code is not working on this settings?

Similar Threads

  1. S60 3rd - local HTTP proxy
    By neil.young in forum Symbian
    Replies: 5
    Last Post: 2008-02-09, 04:46
  2. http connection via a proxy programmatically
    By tiansun in forum Mobile Java General
    Replies: 0
    Last Post: 2005-04-19, 02:47
  3. Resolving proxy settings for a connection in run-time
    By tuksu in forum Symbian Networking & Messaging (Closed)
    Replies: 2
    Last Post: 2002-10-18, 11:14
  4. Proxy Settings for 9210 MIDP software
    By meherzad in forum Mobile Java General
    Replies: 0
    Last Post: 2002-07-19, 08:39

Posting Permissions

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