If you develop j2me applications you can connect with our tiny client java library which is specific to applets and j2me applications.
The 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
If your mobile supports MIDlets, try it online with this URL:
http://www.xmlblaster.org:8080/xmlBlaster/j2me/SystemInfo.jad
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.
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}.
To compile the application you then invoke:
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:
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):
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 xmlBlaster/demo/http/WEB-INF/web.xml
before creating the war file.
cd xmlBlaster build -DTOMCAT_HOME=/opt/jakarta_tomcat deploy_war
Set TOMCAT_HOME to point to your installation and the xmlBlaster.war
will be automatically deployed to $TOMCAT_HOME/webapps/xmlBlaster.war
java org.xmlBlaster.Main -plugin/xmlrpc/port 8081 java http.dhtml.systemInfo.SystemInfoPublisher
The $TOMCAT_HOME/webapps/xmlBlaster.war was created and copied already in step 1.
cd $TOMCAT_HOME/bin startup.sh
build j2me
The result is xmlBlaster/demo/j2me/SystemInfo.jar and xmlBlaster/demo/j2me/SystemInfo.jad.
SystemInfo.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
xmlBlaster/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
Start 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
For 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
If 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
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.