Download I About j2Me MIDlet

Document related concepts
no text concepts found
Transcript
Projet LuxDeal
Mathieu Baeumler, Fabrice Daugan
&
David Hoeung
Presentation of LuxDeal

An exchange based service
LuxDeal Features


Login, Logout, User profile and settings
Search an offer by :







Category
City
Country
Keywords
Submit, see an offer
Propose a deal with another member
Multi-languages
Problématiques

…
Considerations

Battery life

Memory

CPU

Bandwidth

Design
SOAP
Simple Object Access Protocol




Based on XML
Procedure calls on remote objects
Exchange of structured, typed informations
on the Web
Support of severals protocols and internet
formats (SMTP, MIME, HTTP…)
SOAP

Creation of Web-services

Define elements to specify :



Method’s name
parameters
retourned type
Royco minute
SOAP
SOAP

SOAP requests: LIEBIG
<soap:Body>
<ns1:login xmlns:ns1="urn:LuxdealService">
<username xsi:type="xsd:string">cedrprus</username>
<password xsi:type="xsd:string">newpass</password>
</ns1:login>
</soap:Body>
Apache SOAP

Popular :

Java

Complet API

Open source
Server
Tomcat

Developed by Apache (project jakarta)

HTTP Server

Servlets Container
JerryMouse
Tomcat

Two objects :

An initialization class (servlet)


Connection to MYSQL, DB’ managing,
authentification
An implementation class

Service’s method
JerryMouse
Tomcat

Definition of Web-service:

‘web.xml’


Parameters of service (login root, path…)
‘deploymentDescriptor.xml’

Profils of functions
Mysql with Easy-php
Soap admin
Smartphone
Mobile-base smartphone device
Windows CE
Smartphone Toolkit
Smartphone 2002 SDK, eMbedded Visual C++ 3.0
Smartphone 2003 SDK
eMbedded Visual C++4.0 SP2
Visual Studio .NET 2003 CF
Developing the application
Two problems to resolve :
Deals with Windows User Interface
No MFC
ATL
Win 32 API
Messaging with SOAP
MS Soap Toolkit not available for eMbedded Visual C++
HTTP + XML
HTTP
WinInet API
InternetOpen()
ConnMgrEstablishConnectionSync()
InternetConnect()
HttpOpenRequest()
HttpSendRequest()
InternetReadFile()
XML
Format SOAP message
Parsing XML using MSXML DOM using COM
CSoapConnector
Designing User Interface
With the IDE resource editor
Dialog
Control
String table
Multi User Language
Message Loop and Callback
Creating CDialogNWT
Architecture
No MVC
No Document/View
A dialog class by Dialog resource
j2me
I
About j2Me
II
Networking
III Application creation
IV
Emulation
j2me
I
About j2Me
MIDlet (MID Application)
Mobile Information Device caracteristics :
MID
MIDP assumptions on MIDs
MIDP Classes Libraries
MIDP Architecture
j2me
Non usual life cycle
of MIDLet
Life cycle
Restart
Destroy
Pause
the
the
Start
3
Create
states
the
thethe
MIDLet
MIDLet
MIDLet
MIDLet
MIDP 1.0 & 2.0 UI Class Hierarchy
MIDlet composition
JAR file
JAD file
j2me
I
About j2Me
II
Networking
SOAP
Libraries :
KSOAP 1.2
or
KSOAP 2.0
http://ksoap.enhydra.org/
KSOAP 1.2
Libraries :
Use KXML 2.0
http://kxml.enhydra.org/
SSL
Libraries :
KSSL
or
SSL
http://kssl.enhydra.org/
j2me
I
About j2Me
II
Networking
III Application creation
j2me
SDK’s
Beta Release of the J2ME Wireless Toolkit 2.1 (WTK21)
Sprint PCS Java Wireless Toolkit 1.0.3_01
Sony Ericsson SDK 1.2
Siemens Mobility Toolkits (SMTK) for Java™
Motorola SDK v4.0 for J2ME
Nokia Developer's Suite for J2ME(TM) 2.0 (2.6.2003)
Impronto Developer Kit for Linux
Application creation
1)
Compilation
2)
Preverification
3)
Obfuscation
4)
Jarring and JAD updating
5)
Deployment
Compilation
Depending on targeted device
Simple javac
Wireless
MotorolaTool
example
Kit 2.1
: example :
javac -target
-g:none1.1
-bootclasspath
-O -bootclasspath
..\simulators\WTK21\lib\midp20.zip;..\lib\soap -d -d
..\simulators\motorolaA760\lib\midp.zip;..\lib\soap
..\tmpclasses ..\src\luxdeal\*.java
-classpath ..\tmpclasses
..\src\luxdeal\*.java
Preverification
* Needed to check the forbidden dynamic class
loading and many other security actions.
* Replace byte code of javac compiled classes and
reduce a bit their size.
* Depending on targeted device.
Wireless
MotorolaTool
example
Kit 2.1
: example :
..\simulators\motorolaA760\bin\preverify
..\simulators\WTK21\bin\preverify
-classpath
-classpath
..\simulators\WTK21\lib\fulllib.zip -d ..\classes
..\simulators\motorolaA760\lib\midp.zip;..\tmpclasses;..\li
..\tmpclasses
b
-d ..\classes ..\tmpclasses
Obfuscation
* Reduces final jar size down to 30% to fit to the
device space memory
* Prevents the jar to be decompiled
* Do not depend on targeted device.
RetroGuard obfuscator example :
java -classpath
..\obfuscators\retroguard.jar;..\simulators\WTK21\wtklib\
emptyapi.zip;..\lib RetroGuard LuxDeal-org.jar LuxDealobf.jar script.rgs
Jaring and updating Descriptor
* Reduces final jar size down to 30% to fit to the
device space memory
* Prevents the jar to be decompiled
* Do not depend on targeted device.
Jarring : JAD file (jar size attribute) :
Updating
jar cmf
java
-classpath
MANIFEST.MF
. JadUpdater
LuxDeal.jar
LuxDeal.jar
-C ..\classes
LuxDeal.jad
. -C ..\res .
<?xml version="1.0" ?>
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN"
"http://www.wapforum.org/DTD/wml_1.1.xml" >
<wml>
Deployment
<template>
<do type="codev" label="Back">
•Create a WML page
</do>
•Upload to web server or localhost
</template>
• luxdeal.wml
(assuming it’s
the name
of our created wml
<card id="card1"
title="LuxDeal
download
Page"
file)
newcontext="true">
<p align="center">
•LuxDeal.jad
LuxDeal download Page <br/>
•LuxDeal.jar
<a href="http://192.168.200.108:5555/LuxDeal.jad">
LuxDeal
J2Me</a><br/>
</p>
</card>
</wml>
Configure server for JAD files
AddType text/vnd.sun.j2me.app-descriptor jad
AddType application/java-archive jar
for Notes add the following to httpd.cnf:
#
# J2ME Stuff
#
AddType .wml text/vnd.wap.wml 8bit # WML
AddType .jad text/vnd.sun.j2me.app-descriptor for .jad files
AddType .jar application/java-archive for .jar files.
j2me
I
About j2Me
II
Networking
III Application creation
IV
Emulation
Tested devices
SUN devices
Sprint PCS devices
Sony Ericsson : P900
Motorola : A760
Nokia : 60xx
SUN
A760
P900
Nokia 60xx
Sprint PCS
(Minimal)
Conclusion

…