S60 Platform: HTTP Client Example v2.0
--------------------------------------
This C++ application demonstrates simple HTTP GET and POST transactions using
HTTP Client API. Basic HTTP authentication is also supported.
--------------------------------------------------------------------------------
PREREQUISITES
Symbian C++ basics
Basic knowledge of HTTP protocol
--------------------------------------------------------------------------------
IMPORTANT FILES/CLASSES
HTTPClientExample\src\ClientEngine.cpp: contains the implementation of HTTP
Client API usage. Other source files form the typical Avkon GUI application.
Classes: RHTTPSession, RHTTPTransaction, RHTTPHeaders, MHTTPDataSupplier,
MHTTPAuthenticationCallback, MHTTPTransactionCallback
--------------------------------------------------------------------------------
KNOWN ISSUES
No known issues.
The UIDs are different in S60 2nd and 3rd Editions. For self signing, the UID can't
be from the protected range. Because of this, all UIDs are changed from 0x0... to 0xE...
for S60 3rd Edition. UIDs 0xE don't work in S60 2nd Edition, so the UIDs 0x0 have to be
used for older SDKs, otherwise a "(45) : Number too big for LONG" error occurs.
--------------------------------------------------------------------------------
RUNNING THE EXAMPLE
Start the HTTP Client Example application.
The Options menu provides the following commands:
HTTP Get Opens a URI query dialog and issues an HTTP GET transaction.
HTTP Post Opens a URI and data query dialog, and issues an HTTP Post
transaction.
Cancel Cancels running transaction. This command is visible only when a
transaction is running:
Note that running the application requires correctly configured networking
(on the emulator) and Internet access point (on the device).
--------------------------------------------------------------------------------
BUILD & INSTALLATION INSTRUCTIONS
Steps for building and installing the application to a device depend on the S60 platform version:
--Mobile device (S60 3rd Edition)
cd to /HTTPClientExample/group
bldmake bldfiles
abld build gcce urel
cd to /HTTPClientExample/sis
Edit the HTTPClientExample_S60_3rd_ed.pkg's paths to match those on your system.
makesis HTTPClientExample_S60_3rd_ed.pkg
Sign the SIS package.
- See the SDK Help for information about self-signed .sis packages, or
www.symbiansigned.com for information about Developer Certificates.
Install the signed .sis file to an S60 3rd Edition device.
- If you get a "Certificate error" during installation of a self-signed
package, check that App.Manager -> Settings -> Software Installation is
set to "All."
--Mobile device (S60 2nd Edition)
cd to /HTTPClientExample/group
bldmake bldfiles
abld build armi urel
cd to /HTTPClientExample/sis
Edit the HTTPClientExample_S60_2nd_ed.pkg's paths to match those on your system.
makesis HTTPClientExample_S60_2nd_ed.pkg
Install the SIS file to the device.
--Emulator (WINSCW)
cd to /HTTPClientExample/group
bldmake bldfiles
abld build winscw udeb
Start the emulator.
--Carbide.c++ IDE
The example can also be imported into Carbide.c++ IDE. Note that the source
code of this code example itself supports building to both S60 2nd and 3rd Editions.
However, when imported to Carbide, it needs to be imported to separate S60 2nd
and 3rd Edition projects. This is because Carbide only supports multiple project
configurations between S60 2nd Edition releases and S60 3rd Edition releases;
it is not possible to build from the same source to both S60 2nd and
3rd Editions. So, for further development in Carbide, the
changes need to be implemented twice.
Note also that Carbide does not deal with MMP files when creating and building
applications, but it is still possible to import existing applications to Carbide
from an MMP file. In this code example, the MMP file provides some additional definitions
that allow seamless importing of all required application directories and files to
Carbide.
Steps for importing to Carbide.c++:
1. Make sure that the path for current Carbide workspace does not contain any
white-space characters.
If necessary, select a new workspace folder in Carbide (File -> Switch workspace
).
2. Extract the example package to a temporary folder.
3. Select File -> Import
-> Symbian MMP File, click Browse, and find the .mmp file
you want to import (for S60 2nd Edition or S60 3rd Edition and later).
Select the appropriate SDK/configurations.
Check that "Copy source files into workspace" is selected, and then click Finish.
The project is now ready to be built:
--Mobile device (S60 3rd Edition)
Select Project -> Properties -> C/C++ Build
Set Configuration: "S60 3.0 Phone (GCCE) Release" and press OK.
Select Project -> Build project
Install the SIS file to the device.
Install the signed .sis file to an S60 3rd Edition device.
- If you get a "Certificate error" during installation of a self-signed
package, check that App.Manager -> Settings -> Software Installation is
set to "All."
--Mobile device (S60 2nd Edition)
Select Project -> Properties -> C/C++ Build
Set Configuration: "S60 2.8 Phone (ARMI) Release" or "S60 2.8 Phone (Thumb) Release"
and press OK.
Select Project -> Build project
Install the SIS file to the device.
--Emulator (WINSCW) (S60 3rd or 2nd Edition)
Select Project -> Properties -> C/C++ Build
Set Configuration: "S60 3.0 Emulator Debug" or "S60 2.8 Emulator Debug" and press OK.
Select Project -> Build project
Select Run -> Run As -> Run Symbian OS Application
--------------------------------------------------------------------------------
COMPATIBILITY
S60 2nd Edition
S60 3rd Edition
Tested on Nokia 6600, Nokia 7610, Nokia 6630, Nokia 3250, Nokia 6670, Nokia E60, and Nokia N80 devices.
Created/tested with S60 2nd Edition SDK (v7.0s) for Symbian OS, Supporting Feature
Pack 2, for C++, Supporting Metrowerks CodeWarrior;
and with S60 3rd Edition SDK (9.1) for Symbian OS, for C++, Supporting Metrowerks CodeWarrior.
--------------------------------------------------------------------------------
VERSION HISTORY
2.0 Final S60 3rd Edition support
1.1 - Application updated to support S60 3rd Edition
(conditional compiling macros used in order to maintain backward
source compatibility).
- Added BaseConstructL() call to view constructor (CAknView-derived)
(without this, Avkon 59 panic is raised in S60 3rd Edition).
- Created ..\data folder and moved *.rss there. Original mmp renamed to
HTTP_Client_2x.mmp.
- NetworkServices capability needed.
1.0 First release
--------------------------------------------------------------------------------
EVALUATE THIS RESOURCE
Please spare a moment to help us improve documentation quality and recognize the examples
you find most valuable, by rating this resource at
http://www.forum.nokia.com/main/1%2C%2C90%2C00.html?surveyId=b740b0e2-1201-4471-bbd4-1d9c77bcfa97/S60_Platform_HTTP_Client_API_Example_v2_0_en.zip.