This J2EE tutorial covers building and porting JAX-RPC style Webservices to JAX-WS.
Tools used for this tutorial exercise are
JBossWs 2.0.1GA (Jboss's JAX-WS implementation)
JBoss 4.2.1GA - (J2EE Application server)
Eclispe IDE 3.2 >=
Apache Ant
1.1 Background
- 1.1.1 JAX-RPC
- 1.1.2 JAX-WS
- 1.2.1.1 SOAP 1.2
- 1.2.1.3 WS-I's Basic Profiles
- 1.2.1.4 New Java features
- 1.2.1.5 The data mapping model
- 1.2.1.6 The interface mapping model
1.3 Porting Steps
- 1.3.1 Naming conventions
- 1.3.2 Generate Stubs
- 1.3.3 Ant target to generate stubs
- 1.3.4 Test Webservices Client
- 1.3.5 Logging SOAP Packet
- 1.3.6 Instructions for setting up SOAP packet logging on client side
- 1.3.7 Test client snippet
- 1.4.1 Define a Remote Interface
- 1.4.2 Implement a Stateless Session Bean
- 1.4.3 Build Jar
- 1.4.4 Run an EJB Client
1.1 Background
1.1.1 JAX-RPC
JAX RPC style of webservices is built on JSR-101 specification.
JBoss 4.0.4 server comes with JBossWs 1.0 series which has support for JAX-RPC and non JAX-WS style, i:e; JSR-101 (JAX-RPC) and JSR-109 (non JAX-WS) style webservices respectively, rather than JSR-181 (JAX-WS) compliant. Strictly speaking, JbossWS 1.0 is not a JAX-WS compliant as it is missing JSR-181 impelmentation.
It only supports SOAP 1.1.
1.1.2 JAX-WS
JAX-WS style of web services is built on JSR-224 specification.
It uses annotations (JSR-181) and new data binding stack JAXB. JbossWS 2.0 >= series which
is used in this porting exercise is JAX-WS compliant.
In addition to being JAX-WS compliant, for backward compatibilty it has support for JAX-RPC(JSR-101) and JSR-109 compliant services used in JBoss 4.0.4.
It supports SOAP 1.1 and SOAP 1.2.
1.2 Differences
Their are quiet a few notable differences between JAX-WS and JAX-RPC. Notable ones to keep in mind while porting are in italics.
1.2.1.1 SOAP 1.2
JAX-RPC and JAX-WS support SOAP 1.1. JAX-WS also supports SOAP 1.2.
1.2.1.2 XML/HTTP
The WSDL 1.1 specification defined an HTTP binding, which is a means by which you can send XML messages over HTTP without SOAP. JAX-RPC ignored the HTTP binding. JAX-WS adds support for it.
1.2.1.3 WS-I's Basic Profiles
JAX-RPC supports WS-I's Basic Profile (BP) version 1.0. JAX-WS supports BP 1.1. (WS-I is the Web services interoperability organization.)
1.2.1.4 New Java features
JAX-RPC maps to Java 1.4. JAX-WS maps to Java 5.0. JAX-WS relies on many of the features new in Java 5.0.
Java EE 5, the successor to J2EE 1.4, adds support for JAX-WS, but it also retains support for JAX-RPC, which could be confusing to today's Web services novices.
1.2.1.5 The data mapping model
JAX-RPC has its own data mapping model, which covers about 90 percent of all schema types. Those that it does not cover are mapped to javax.xml.soap.SOAPElement.
JAX-WS's data mapping model is JAXB. JAXB promises mappings for all XML schemas.
1.2.1.6 The interface mapping model
JAX-WS's basic interface mapping model is not extensively different from JAX-RPC's; however:
JAX-WS's model makes use of new Java 5.0 features.
JAX-WS's model introduces asynchronous functionality.
1.2.1.7 The dynamic programming model
JAX-WS's dynamic client model is quite different from JAX-RPC's. Many of the changes acknowledge industry needs:
- It introduces message-oriented functionality.
- It introduces dynamic asynchronous functionality.
1.2.1.7 MTOM (Message Transmission Optimization Mechanism)
JAX-WS, via JAXB, adds support for MTOM, the new attachment specification. Microsoft never bought into the SOAP with Attachments specification; but it appears that everyone supports MTOM, so attachment interoperability should become a reality.
1.2.1.8 The handler model
The handler model has changed quite a bit from JAX-RPC to JAX-WS.
JAX-RPC handlers rely on SAAJ 1.2. JAX-WS handlers rely on the new SAAJ 1.3 specification.
Part - 2 of tutorial is continued here
Other useful tips on J2EE
- J2EE Server Side Debugging in Eclispe
- Convert java.sql.Timestamp to java.util.Date
- What is HTTP tunneling
- What is the Difference between HashMap and HashTab...
- What are Checked and UnChecked Exceptions
- How to do a deep clone of an object
- What are the common methods used for session track...
- Run EJB client in Eclipse with jndi properties as ...
- How to startup and stop J2EE application server fr...
- How Agile development is being perceived
- List of Java code anlayser tool
- Linux Networking Tutorial
- Best Computer Book
0 Responses to J2EE Tutorial on Webservices using JBoss
Something to say?