Please note that as of October 24, 2014, the Nokia Developer Wiki will no longer be accepting user contributions, including new entries, edits and comments, as we begin transitioning to our new home, in the Windows Phone Development Wiki. We plan to move over the majority of the existing entries over the next few weeks. Thanks for all your past and future contributions.

Archived:Using the HTTP Client API with RConnection

From Wiki
Jump to: navigation, search

Archived.pngArchived: This article is archived because it is not considered relevant for third-party developers creating commercial solutions today. If you think this article is still relevant, let us know by adding the template {{ReviewForRemovalFromArchive|user=~~~~|write your reason here}}.

Article Metadata
Tested with
Devices(s): All
Platform(s): S60 5th Edition
S60 3rd Edition and Feature Packs
S60 2nd Edition and Feature Packs
Series 80 2nd Edition
S60 3rd Edition (initial release)
S60 2nd Edition (initial release)
Keywords: RHTTPSession, RConnection, RHTTPConnectionInfo, EHttpSocketConnection, EHttpSocketServ, RStringPool, RHTTPHeaders
Created: User:Technical writer 1 (07 Apr 2005)
Last edited: hamishwillee (14 Jun 2012)


Using the HTTP Client API with RConnection


If you use the HTTP Client API, there are no chances to specify connection preferences. The default preference is to show the IAP selection dialog. However, it is more user-friendly that the IAP is selected only once by the user. The solution is to create a connection using RConnection, where you can define connection preferences as you like. Then you can attach a HTTP session to the connection as shown before.

// Initiate connection
RHTTPConnectionInfo connInfo = iHttpSession.ConnectionInfo();
RStringPool pool = iHttpSession.StringPool();
// Attach to socket server
connInfo.SetPropertyL(pool.StringF(HTTP::EHttpSocketServ, RHTTPSession::GetTable()), THTTPHdrVal(iSocketServ.Handle()));
// Attach to connection
TInt connPtr = REINTERPRET_CAST(TInt, &iConnection);
connInfo.SetPropertyL(pool.StringF(HTTP::EHttpSocketConnection, RHTTPSession::GetTable()), THTTPHdrVal(connPtr));
// Open transaction...
iHttpTrans = iHttpSession.OpenTransactionL(iUri, *this, pool.StringF(HTTP::EGET, RHTTPSession::GetTable()));
RHTTPHeaders hdr = iHttpTrans.Request().GetHeaderCollection();
This page was last modified on 14 June 2012, at 05:49.
79 page views in the last 30 days.

Was this page helpful?

Your feedback about this content is important. Let us know what you think.


Thank you!

We appreciate your feedback.