REQUIREMENT client.j2me |
Type | NEW |
Priority | LOW |
Status | CLOSED |
Topic | XmlBlaster provides a tiny java client library for j2me MIDlets |
Des cription |
If you develop j2me applications you can connect with our tiny client java library which is specific to applets and j2me applications. Features
OverviewThe following illustration shows a typical use case, a MIDlet running for example in a cellular phone or in a PAD contacts the Web Server, for example Apache, which directs the call to a servlet engine with xmlBlasters communication servlet. The servlet looks at the applet request and opens a connection to xmlBlaster to delegate the request. Supported MIDget methods are
Online demo
If your mobile supports MIDlets, try it online with this URL:
NOTE: If you compile with JDK 1.5 final release the SystemInfo.jar application fails when loaded by the emulator, you need to force to 'javac -source 1.4 -target 1.4'. If you use our build.xml this is enforced already. |
Example Java |
There is a little demo showing the way this works. The demo SystemInfo has the same functionality as the SystemInfoApplet. In order to be run it needs a running xmlBlaster (with the xmlrpc port redirected or disactivated), a SystemInfoPublisher which publishes on the given xmlBlaster and a servlet engine running (for example apache's tomcat). If you don't want to bother about configuring and starting these, you can use the ones which constantly run on the xmlBlaster server. The url of the servlet is http://www.xmlBlaster.org:8080/xmlBlaster/AppletServlet.
If you have access to an embedded device which supports j2me (and more precisely CLDC-1.1 and
MIDP-2.0 profile) you can download the precompiled demo application directly from the xmlBlaster server:
If you are not that lucky of having such a device you still can try this demo out by using an
emulator. You can download sun's j2me development kit which allows you to compile the
applications yourself. You can find it at
Sun's j2me pages.
Once you have downloaded it install it in a directory of your choice. Lets say you
install it on ${J2ME_HOME}. build -DJ2ME_HOME=${J2ME_HOME} j2meto run the application run: ${J2ME_HOME}/bin/emulator -Xdescriptor ${XMLBLASTER_HOME}/demo/j2me/SystemInfo.jadand an application similar to this should appear: |
Example Java |
Quick start installation of the server side stuff (if you want the server to be run locally)You can try it with tomcat locally (no apache is necessary, i had tomcat 3.2.4, 4.1.29 and 5.0.14 to test it, others should work as well): 1. Create a war file:
The $TOMCAT_HOME/webapps/xmlBlaster.war file contains all necessary
servlets and xmlBlaster client library to forward requests to xmlBlaster.
You can have a look at the configuration
in cd xmlBlaster build -DTOMCAT_HOME=/opt/jakarta_tomcat deploy_war
Set TOMCAT_HOME to point to your installation and the 2. Start the xmlBlaster server and a demo publisher (keep port 8080 free for tomcat)java org.xmlBlaster.Main -plugin/xmlrpc/port 8081 java http.dhtml.systemInfo.SystemInfoPublisher 3. Start the tomcat web serverThe $TOMCAT_HOME/webapps/xmlBlaster.war was created and copied already in step 1. cd $TOMCAT_HOME/bin startup.sh 4. Create the jar file which is transferred to the mobile devicebuild j2me The result is xmlBlaster/demo/j2me/SystemInfo.jar and xmlBlaster/demo/j2me/SystemInfo.jad. Edit your SystemInfo.jad fileYou need to add the URL which points to theSystemInfo.jar file and to the
servlet AppletServlet to the SystemInfo.jad file:
MIDlet-1: SystemInfo, SystemInfo.png, SystemInfoMidlet MIDlet-Info-URL: http://www.xmlblaster.org/xmlBlaster/doc/requirements/client.j2me.html MIDlet-Jar-Size: 27299 MIDlet-Jar-URL: http://localhost:8080/xmlBlaster/j2me/SystemInfo.jar MIDlet-Name: SystemInfo MIDlet-Vendor: www.xmlBlaster.org MIDlet-Version: 1.0 MicroEdition-Configuration: CLDC-1.0 MicroEdition-Profile: MIDP-1.0 servletUrl: http://localhost:8080/xmlBlaster/AppletServlet
Now copythexmlBlaster/demo/j2me/SystemInfo.jar and
xmlBlaster/demo/j2me/SystemInfo.jad file to be available on the web server (tomcat):
mkdir $TOMCAT_HOME/webapps/xmlBlaster/j2me cp ${XMLBLASTER_HOME}/demo/j2me/SystemInfo.ja? $TOMCAT_HOME/webapps/xmlBlaster/j2me 5. Watch the result with your mobileStart the emulator or if you have a mobile device somehow connected to you computer run it: ${J2ME_HOME}/bin/emulator -Xdescriptor ${XMLBLASTER_HOME}/demo/j2me/SystemInfo.jad ${J2ME_HOME}/bin/emulator -Xdescriptor http://localhost:8080/xmlBlaster/j2me/SystemInfo.jad http://localhost:8080/xmlBlaster/j2me/SystemInfo.jad NoteFor convenience the Urls of SystemInfo.jad can be passed to ant and will be replaced as shown above: build -DJ2ME_HOME=/opt/WTK2.1 -DMIDlet-Jar-URL=http://localhost:8080/xmlBlaster/j2me/SystemInfo.jar -DMIDlet-servletUrl=http://localhost:8080/xmlBlaster/AppletServlet j2me ProblemsIf the emulator says 'Warning: Failed to initialize WMA message routing support' try setting write permissions to your J2ME directory: chmod a+rwx ${J2ME_HOME} chmod a+rwx ${J2ME_HOME}/appdb |
Configure |
AddType text/vnd.sun.j2me.app-descriptor .jad AddType application/java-archive .jarand then restart the apache server. More about "Over The Air" (OTA) Provisioning can be found here.
NOTE: Configuration parameters are specified on command line (-someValue 17) or in the
xmlBlaster.properties file (someValue=17). See requirement "util.property" for details. |
See API | org.xmlBlaster.client.protocol.http.common.I_XmlBlasterAccessRawBase |
See REQ | interface |
See REQ | client.browser |
See REQ | client.java.applet |
See | Mobile development kits from Sun |
See | http://jakarta.apache.org/tomcat/ |
See | http://www.xmlBlaster.org:8080/xmlBlaster/index.html |
See | http://www.xmlBlaster.org:8080/xmlBlaster/HelloWorld3.html |
See | http://www.xmlBlaster.org:8080/xmlBlaster/SystemInfoApplet.html |
See | Emulator from Nokia |
See | Emulator from Motorola |
This page is generated from the requirement XML file xmlBlaster/doc/requirements/client.j2me.xml