Sun Java Solaris Communities My SDN Account Join SDN
 

Sun Mobile Device Technology - Chat Transcripts

 
 

Creating Mobile Applications to Communicate with Web Services

 

"Chat with Martin Ryzl, Engineering Manager, and Petr Suchomel, Technical Lead" Moderated Chat
September 28, 2004 9:00am PDT/16:00 UTC
Guest: Martin Ryzl (martin_r), Engineering Manager, and Petr Suchomel (petr_s), Technical Lead
Moderator: Bao Phan (bao)

This is a moderated forum. This transcript has been edited for better readability.


bao
Welcome to the Sun Developer Network Moderated Chat series. Today's topic is "Creating Mobile Applications to Communicate with Web Services." My name is Bao Phan and I'm the moderator for this chat. Our speakers today are Martin Ryzl, Engineering Manager, and Petr Suchomel, Technical Lead for the Sun Java Studio Mobility IDE.

Just a couple of housekeeping notes before we begin:

You are connected to our chat application, and your session must be maintained in order to stay connected. Please do not point your current browser to another URL, otherwise you will be dropped from the chat. You may open up another browser if you need to access another URL while staying connected to the chat.

When you submit a question to the speakers, your question will not immediately appear in the chat room. It is sent to the speakers and will appear when the speakers post their response to your question.

With that, I'd like to invite you to begin sending your questions to our speakers. To start things off, Martin, can you give us a quick summary of what JSR 172 is and why it's important?

martin_r
It is a specification for J2ME Web Services and it allows MIDlets to connect to existing web services.

budvar
Is there a wizard to create a web services MIDlet?

petr_ s
Yes, we have a wizard which allows easy creation of web service clients in just few a clicks.

budvar
What does the wizard create for me? Is the output a working MIDlet?

petr_s
Yes, all necessary classes are created together with the MIDlet, which shows basic usage of the generated code.

theshapechanger
Does it matter if you're working with HTML, XML, or XHTML, and which would be best?

martin_r
I'm not sure I understand your question in the context of J2ME Web Services.

lisa
What are MIDlets?

martin_r
A MIDlet is a small application for mobile phones or similar devices, defined by the MIDP (Mobile Information Device Profile) specification.

nuts
Good morning everyone. I'm using axis for my web services, I'm not using J2ME but I'm using Brew. My question is, is Axis supported by J2ME for web services?

petr_s
I am not aware about Axis, but you can generally access any web service, which is WS-I compliant.

michele
What is WS-I?

petr_s
More about WS-I can be found here: www.ws-i.org

budvar
Can Sun Java Studio Mobility find a WSDL file by specifying a URL?

petr_s
Yes, there are three options for input into the wizard: URL, existing file, or WSDL object generated by Sun Java Studio.

theshapechanger
WSDL?

martin_r
It is a language for description of web service interfaces, based on XML. Web Service Definition Language.

jgarcia
Is there any copyright constraint on MIDlets?

petr_s
No.

michele
Can you give us a quick background on J2ME Web services? Which are the main differences with "standard" Web services (if there are any).

martin_r
J2ME Web Services are designed to work on J2ME CLDC/MIDP devices. So it is a little bit limited. For example CLDC 1.0 doesn't support floats and doubles.

legitimator
There is a J2ME Web Services Implementation from Sun. We used it to access web services with a Blackberry-handheld.

jmro-bancomext
How can I implement this technology with GPS (global position satellite) in one application made in Java?

martin_r
There are several possible solutions. For instance, a device may have a GPS chip and provide appropriate APIs. Another possibility is a Location service provided by an operator and available through web services.

nuts
How do I add the corresponding jars to work with web services, do i have to install them when I install J2ME or they come with each app I install to the device?

petr_s
The JSR 172 is upcoming core functionality in mobile phones. This means, if a mobile phone is JSR 172 compliant, you can execute your app without any additional steps.

Vicente
I need to know are MIDlets run under a mobile browser or are they independent?

martin_r
A MIDlet is a Java application, it doesn't run in a browser. However, it only can run on a device which has a virtual machine.

legitimator
The J2ME Web Services Pack (Yes, JSR 172) has a stub generator. We used it with a WSDL file generated by the axis-tool Java2WSDL. Therefore we had to modify the WSDL. The most important thing is, that an array has to be described as specified in the WS-I-Basic Profile.

dobr_pan4ev
Hi, I am developing a mobile application which downloads pictures from a web server to a mobile phone. Pictures are Base64 encoded in XML along with descriptions. When parsing the XML stream on the phone (J2ME SAX parser) to get the picture data into a buffer I get an OutOfMemoryException even if the picture data is as small as 10kB (my phone has 150kB memory for Java). On the simulator everything is fine (he has 500kB), but why does parsing XML needs so much memory?

martin_r
Well, I think it is a problem of XML. Parsing requires a certain amount of memory. We have experienced the same problems when kSoap was released a few years ago. It worked very well on an emulator but not on a real device.

tpc
Does that mean I can use any service for which I can find the WSDL? How/where does the schema get pulled in to be able to formulate requests properly, and deal with the output?

petr_s
The service must be WS-I compliant for JSR 172 implementation. The schema is processed by Sun Java Studio Mobility and a proper implementation is generated.

legitimator
Another thing is, that the Sun implementation of JSR 172 accepts only methods with ONE object as parameter.

gmhinga
I build predictive models for clients and would like to give them access to results (scorecards, statistics, etc.) via mobile devices. In general, would I create a web site, then a web service, then install an app on their mobile device?

martin_r
Yes. Also, if you use Sun Java Studio Mobility there are two possible technologies. either J2ME Web Services or the J2ME Wireless Connection Wizard. The latter is probably better for most of the current devices because it generates a servlet, MIDlet, and code which provides communication between the servlet and MIDlet using plain http. It is faster and consumes less memory than web services.

Vicente
How do I load my MIDlet to the mobile phone?

petr_s
There are a variety of options, depending on vendor and/or carrier. By cable, infrared port, bluetooth, and finally by OTA (Over The Air execution) which should be supported by the carrier.

Vicente
Which mobile phones support Java?

martin_r
Many current phones. see for example http://jal.sun.com/webapps/device/device

Chris
How is the parsing of the XML handled in the MIDlet?

petr_s
The parsing is done in core and core classes of KVM. This means, parsing internally can be vendor dependent. While the JSR 172 API is vendor independent (write once, run anywhere), the KVM parsing implementation can differ from vendor to vendor to get the best processing performance.

olga
The mobile devices are typically very limited in processing speed and network bandwidth. It is tough to parse text XML on the handhelds for example. Are there any special provisions in SOAP HTTP protocol for J2ME that address these issues?

petr_s
That is why JSR 172 was introduced. The parsing can be moved (depending on implementation) to the native part of the virtual machine.

billwerth
Does the IDE provide emulation for specific mobile phones?

petr_s
No. The IDE currently provides only a reference implementation provided by the Wireless Toolkit 2.1 which is co-bundled.

zheng
I'm developing MIDlets for Blackberry, how much support does SJS have for Blackberry?

petr_s
There is no support for Blackberry in this moment.

isidro
When will J2ME support a Web Services Server? (now we can only build Web Services Client using J2ME)

martin_r
Well, interesting question. First of all, J2ME CLDC is targeted for devices with limited memory, CPU, connection and it might be difficult to implement such a server there. Also, do you think there are customers who would like to have it?

Guest
How is the licensing done?

martin_r
Licensing of what? J2ME, MIDP, web services technologies in general, particular product? Please, be more specific.

isidro
Is there a version of Java Media Framework for mobile devices?

petr_s
Yes, it is JSR 135.

jmro-bancomext
Nextel has this GPS device, then how can I catch the position with Java - are there some jars to do that?

petr_s
It is more a Nextel specific question. Ask their support for more documentation.

theshapechanger
I am unfamiliar with this particular product. I am creating a site that I would like to make accessible to mobile devices of various types. Is there a connecton between MIDlets and the language a page is created in?

martin_r
MIDlets are Java applications that run on a device. They may access web pages, for example you may write a MIDlet browser but usually the devices have both a JVM and a browser. I don't understand the second part of your question.

Guest
What version of the VM is supported?

martin_r
Could you be more specific, please?

billwerth
Would a disadvantage of the J2ME Wireless Connection Wizard be that it can't be accessed by other web service consumers other than the J2ME client?

petr_s
This can be. WCW is a proprietary implementation, which may not be suitable for generic sharing like web services. It is targeted for closed end-to-end solutions. On the other hand, the target code footprint is small, while speed is good enough even for devices with low computing power.

Guest
What are the basic/standard settings requirements on my mobile device to access MiDinet APPS?

martin_r
What are MiDinet APPS?

olga
You mentioned above that the operators provide location services as web services to applications. Is that operator specific? Where I can read more about these web service interfaces to location-based operator provided services?

martin_r
As far as I know there is no standard yet.

bao
We've just been joined by the product architect, John Muchow. He will be helping to answer all your great questions.

Vicente
Do I need to pay for loading my application to a mobile phone? And is it free to develop a MIDlet and load it to a mobile phone?

john_m
You can write and install MIDlets directly onto a phone without a charge. However, if you want to distribute your MIDlet for others, there may be a charge to host the MIDlet. There are various sources for such services.

jkairos
The XML parser consumes enough amounts of memory, what is the recommended RAM used for the parser? What's the minimum requirement?

petr_s
Not directly inherited, but the expectation is that it should fit into MIDP 2.0 / CLDC1.1 (1.0) requirements for the device.

isidro
How can we discover which devices are JSR 172 compliant? If the mobile device is not JSR 172 compliant, how is the best way for building a Web Service Client?

martin_r
It is usually written in the device specifications. If a device is not JSR 172 compliant, you may use for instance kSoap library or communication based on plain http.

zheng
Currently, most mobile devices don't support JSR 172, so in order to write a web service client using JAX-RPC in such a device, which specific library (jar file) do I need to install on such a device?

john_m
You can develop MIDlets with JSR 172 support in Sun Java Studio Mobility. To use on a device you would need a third party library such as KXML (packaged with your MIDlet).

Vicente
I need to develop a mobile application in Java that can connect to a web service. Which software should I use, during the whole process?

petr_s
You can use Sun Java Studio Mobility 6, which allows you to do all necessary steps just in a few clicks - creating service classes, build and execute an application.

Vicente
Where can I find any tutorials about loading my MIDlet to a mobile phone?

john_m
This is device and/or carrier specific. For instance, with some devices you can use Bluetooth, some older devices require a serial cable, etc. I would start by looking at the device manufacturer web site for information.

isidro
A Web Services Server in J2ME would be useful not to publish complicated services in a mobile device, but it would be useful for communications purposes, simplifying implementation, don’t you think?

john_m
If I understand your question, yes, at this point, with limited memory, network latency issues, etc, it would be a good idea to keep the type of services limited in scope.

michele
To get back to a web services server on devices... It could be useful if you want to build an agent on the device that receives commands from a central management system.

martin_r
Yes. The question is whether a web services server is not too powerful a solution. For example, the current Sun Java Studio Mobility IDE provides two technologies for building end-to-end applications - J2ME Web Services and the J2ME Wireless Connection Wizard (plain http). The second takes less memory and is faster (it doesn't need to parse XML) but some customers prefer web services.

olga
Do I understand correctly that when the parsing is moved to native VM the actual data that gets transmitted as a part of web service calls would be optimized? E.g. native VM can use binary encoding for SOAP XML to use less memory? Any hints how to find out if it is done in a specific VM on the handheld?

petr_s
JSR 172 strictly defines the protocol/API used for communication between the server and the client. The VM implementation is hidden to user.

Vicente
Where can I find any tutorials to develop web services for mobile phones?

john_m
Here is a starting point: http://developers.sun.com/mobility/apis/articles/wsa/index.html

olga
Are there any code samples in source code available that demonstrate how to use Web Services from the mobile handheld using this JSR? If yes, then please help with the link to the site or package that includes them. Thanks.

john_m
Try this tutorial: http://developers.sun.com/mobility/apis/articles/wsa/index.html

theshapechanger
It was said earlier that a MIDlet is on the mobile device and only that mobile device can access the web service...is that correct and what security issues would need to be considered?

petr_s
The security is based on MIDP/CLDC security model. This answers your question?

zheng
Does Sun Java Studio come along with some libraries to support JSR 172? If yes, what are they?

petr_s
It comes bundled with the WTK 2.1 which includes all the necessary libraries for supporting JSR 172.

zheng
If I understand correctly, if a device is JSR 172 supported, does that mean the functions required for JSR 172, like XML/SOAP parser is done in the VM? Does JSR 172 define a set of standard APIs for accessing these functions?

john_m
Yes, exactly. If a device supports JSR 172 it will adhere to the specification, including implementation of the APIs. Here is the specification that you can download: http://www.jcp.org/en/jsr/detail?id=172

dobr_pan4ev
Thanks, I hope as phones become more powerful parsing XML will not be problem in the future. I downloaded Sun Java Studio Mobility and I am really impressed - it's become much easier to use, the option is great - it saves a lot of time. I heard about Wireless Connection Wizard from this chat and I think it's a very good tool. I have another question - according to specifications, MIDlet method pauseApp() must release all resources. My application needs a few seconds to close network connections which run in a separate thread, and when I press the pause button and resume right after that it hangs. How can I make the phone wait for my method pauseApp() to end before it shows the resume button? Currently I decided not to implement pauseApp() and threads work in the background, but I'd like to implement my apps according to specifications :-)

petr_s
It should release shared resources not all resources. All resources must be released in destroyApp. Refer to javadoc for more details.

Vicente
How can I save this chat session?

bao
Vicente, this chat will be archived and posted to our web site. All registrants will receive email notifying you when it is available.

zheng
What is the difference between SJS and WTK? Does SJS include WTK?

petr_s
Yes.

Chris
Will WTK 2.1 be supported in the NetBeans IDE?

martin_r
It already is and even WTK 2.2 :-). Just go to netbeans.org and download the latest NetBeans 4.0 beta2 + Mobility support which is a really good IDE for J2ME MIDP development.

budvar
Where can I download Sun Java Studio Mobility 6?

john_m
http://wwws.sun.com/software/products/jsmobility/index.html

michele
What is the NetBeans IDE?

martin_r
NetBeans is an open source IDE (integrated development environment). It is modular which means it can easily be extended.

budvar
Can I debug a MIDlet that accesses a web service?

martin_r
Yes.

michele
Which features does NetBeans support?

martin_r
See http://www.netbeans.org/products/ide

Vicente
Is there any risk to my mobile phone when I load the MIDlet on it? Can the mobile phone be damaged by this application?

martin_r
No, applications are running in a sandbox. Also MIDP 2.0 introduces more security features - signing, fine grained policy.

Vicente
What is a sandbox?

martin_r
It means that applications are isolated from the device and network.

dobr_pan4ev
Nothing is safer than running Java applications in a sandbox - no matter if it's under Solaris, Linux, Windows or on a mobile phone!

petr_s
Yes, you are right.

nthompson
I have a Java based phone. Do you have a Java application that you have developed, for example for testing, that accesses some web service? I would like to experiment with the technology by just seeing something in action.

petr_s
We do not have an example in the IDE directly, but you can easily import one from standalone installed WTK 2.1 or WTK 2.2.

bao
Housekeeping note: We have 15 minutes left in our chat session today. Please get your questions in now.

zheng
Thanks guys! BTW, any plans to support Blackberry?

martin_r
If there is an emulator from Blackberry, why not. We'd like to support all J2ME devices.

zheng
Thanks guys! BTW, any plans to support Blackberry?

petr_s
Currently, their implementation is different from the J2ME implementation, and we have no plans to support Blackberry now.

dobr_pan4ev
Thank you very much and good luck! Hope to chat again soon :-)

petr_s
Thank you. Looking forward to having next one too :-)

theshapechanger
Thank you for answering my questions, have a great day.

martin_r
You are welcome.

Vicente
Thank you very much for your help, it has been very useful!

martin_r
We are glad you've liked it :-)

Vicente
When will it be the next chat again?

bao
We do not have a regularly scheduled chat for mobility, but make sure you subscribe to our newsletter to find out when we have one.

cghaba
how can we subscribe to the newsletter?

bao
http://developers.sun.com/mobility/nbpack/community/newsletters/index.jsp

bao
Okay, we are coming to the end of our hour. Martin, Petr, and John, do you have any last thoughts for our guests?

martin_r
Ok, we are almost finished. Just one comment, I'm not sure if we explained NetBeans and Sun Java Studio correctly. NetBeans is an open source IDE project sponsored by Sun. Sun Java Studio products are based on NetBeans which means that they extend NetBeans by adding some more modules, more testing, etc. Some URLs:
http://wwws.sun.com/software/products/jsmobility/index.html
http://www.netbeans.org/

bao
Great, thank you. This wraps up our chat for today. I'd like to thank you all for your active participation, and our speakers for doing a great job in answering your questions. I hope you found this information helpful, and this live chat valuable.

An archive of today's chat will be posted on our web site. All registrants will be notified via email once it is available. On behalf of the team here at Sun, thank you and goodbye!

Rate and Review
Tell us what you think of the content of this page.
Excellent   Good   Fair   Poor  
Comments:
Your email address (no reply is possible without an address):
Sun Privacy Policy

Note: We are not able to respond to all submitted comments.
Update Your Java Runtime Environment

NetBeans