Before you start
This series demonstrates how to incorporate security in Java 2, Micro Edition (J2ME)-based wireless access to Web services. We use the following components and technologies together in a J2ME MIDlet:
- Web Services APIs (WSA) for J2ME
- Cryptography
- XML Digital Signature (XMLDS)
- Java Card
In Part 1 of this series, you have already seen how WSA stub classes work. The remainder of this tutorial series demonstrates how to enhance WSA stub classes and integrate other technology components such as cryptography, XML signatures and Java Card into WSA stub classes.
This tutorial series also demonstrates various testing and debugging arrangements that you can use to integrate different technology components. The series concludes by putting together all the concepts into a "stub enhancer tool". This tool will enhance functionality of WSA stub classes by incorporating security features.
In Part 1 of this tutorial, we took a deep look inside WSA by considering simple and extended email services. Part 1 concluded with an introduction to a secure version of the email service.
Part 2 explores the secure email service in detail. In this part, you will generate stub classes for the secure email service. You will take each individual class among the stub classes of the secure email service and learn how to enhance it to provide required security features.
You will also come across a few helper classes in the secure email service that handles XML and security issues like authoring canonical form of XML and calculating digest values.
Therefore Part 2 also teaches you why you need canonicalization and digest algorithms to secure wireless access to your Web services. Part 2 also demonstrates techniques of implementing these algorithms, especially suitable for wireless devices with memory constraints.
The first prerequisite is to read Part 1 of this series.
You will come across various technology components in this tutorial. Therefore, it's important for you to have a basic understanding of the components. Specifically, the following background is assumed:
- You should be familiar with Java programming and have a basic understanding of J2ME MIDlets.
- WSA uses Web Services Definition Language (WSDL) and Simple Object Access Protocol (SOAP). Therefore, you need to know how WSDL interfaces are mapped to SOAP method invocation calls.
Moreover, some background on XML signatures will be useful.
IBM developerWorks has many excellent articles and tutorials about these topics. The Resources section lists some for ready reference.
Who should take this tutorial?
The primary purpose of this series of tutorials is to help you allow wireless access to your Web services -- with or without security.
This part of the series discusses the customization of WSA stub classes for security. Therefore, whenever you feel that standard set of WSA stub classes doesn't suit your application, you can refer to this tutorial for some ideas about customization.
Another point: This part demonstrates how to implement canonicalization and digest calculation algorithms in a memory restrained wireless device. So, this tutorial can also help you implement similar algorithms in wireless devices.
Part 2 consists of the following eight sections:
- Tutorial introduction
- Explanation of the WSDL file for the secure email service. This section also introduces stub classes for the secure email service
- Discussion of how a J2ME MIDlet will use the secure email service. This section also demonstrates how to enhance the main stub class of the secure email service to provide security features
- Discussion of how to enhance the Signature stub class
- Demonstration of how to enhance rest of the stub classes in the secure email service
- Explanation of implementing W3C's canonicalization algorithm for a J2ME application
- Demonstration of calculating digest values
- Wrap-up
Code samples and installation requirements
We used Java Development Kit (JDK) version 1.5, J2ME Wireless Toolkit version 2.2, and Sun Java Wireless Toolkit version 2.3 Beta to generate and try the code for Part 2.
We also used XML Security Suite for Java (XSS4J) from IBM alphaWorks and Xalan from Apache to debug the code for this tutorial. Both of these are open source tools, which you can download by referring to the Resources section of this tutorial.
We will build a Java Card application in Part 3 of this tutorial. Therefore, the third part will also use Java Card Development Kit from the Sun Web site to try the Java Card application.



