Symbian
Symbian OS Library

FAQ-1351 How can I use WAP APNs?

[Index][spacer] [Previous] [Next]



 

Classification: C++ Category: Web & WAP
Created: 01/16/2006 Modified: 02/22/2006
Number: FAQ-1351
Platform: Symbian OS v7.0, Symbian OS v7.0s, Symbian OS v8.0, Symbian OS v8.0a, Symbian OS v8.0b, Symbian OS v8.1a, Symbian OS v8.1b, Symbian OS v9, Symbian OS v9.0, Symbian OS v9.1, Symbian OS v9.2

Question:
How can I use WAP APNs?
How can I set proxy settings for my session/transaction?


Answer:
Unlike IAPs, WAP APNs have a proxy and port defined. The following mechanisms show how to define these properties for a transaction, or for a session (i.e. for all transactions in a session)
 
How to define proxy for an individual transaction

//Open transaction first
iTransaction = iSession.OpenTransactionL(uri, *this, method);
RHTTPTransactionPropertySet transactionProperties = iTransaction.PropertySet();
TBuf8<20> aProxy8(_L8(""));
RStringF prxAddr = iSession.StringPool().OpenFStringL(aProxy8);
CleanupClosePushL(prxAddr);
THTTPHdrVal prxUsage(iSession.StringPool().StringF(HTTP::EUseProxy,RHTTPSession::GetTable()));
transactionProperties.SetPropertyL(iSession.StringPool().StringF(HTTP::EProxyUsage,RHTTPSession::GetTable()), prxUsage);
transactionProperties.SetPropertyL(iSession.StringPool().StringF(HTTP::EProxyAddress,RHTTPSession::GetTable()), prxAddr);
CleanupStack::PopAndDestroy(); // prxAddr

Note that the proxy address and port values should be obtained from the comms database.

How to define the proxy parameters for a session

//Set session properties BEFORE opening a transaction:
TBuf8<20> aProxy8(_L8(""));
RStringF prxAddr = iSession.StringPool().OpenFStringL(aProxy8);
CleanupClosePushL(prxAddr);
THTTPHdrVal prxUsage(iSession.StringPool().StringF(HTTP::EUseProxy,RHTTPSession::GetTable()));
iSession.ConnectionInfo().SetPropertyL(iSession.StringPool().StringF(HTTP::EProxyUsage,RHTTPSession::GetTable()), prxUsage);
iSession.ConnectionInfo().SetPropertyL(iSession.StringPool().StringF(HTTP::EProxyAddress,RHTTPSession::GetTable()), prxAddr); CleanupStack::PopAndDestroy(); // prxAddr

 Note that the proxy address and port values should be obtained from the comms database.


How to define the proxy parameters for a session on Series 60

Series 60 provides the a useful class to simplify setting the proxy values. CHttpFilterProxyInterface automatically retrieves the settings from the comms database for you.

//This automatically uses the proxy settings from the CommDb
//when the APN is chosen by the end user
//Install proxy filter after calling iSession.OpenL()
CHttpFilterProxyInterface::InstallFilterL(iSession);

Note that there is a known defect in CHttpFilterProxyInterface on the Nokia 6630 - on that device the standard methods much be used (i.e. manually get the proxy parameters from the communications database. The method is known to work on the following devices 6600,7610,3230, 6680, 6681.