Spring Web Services

 

A web service is a method of communication over a network using standardized XML messages. Thus providing a way for different types of systems to communicate using XML messages.

 
There are two different development styles for developing web services.
  • Contract Last - You write the implementation first and then wsdl is created from the implementation. JAX-WS Java API for Web Services which is part of JEE defines standard Java-to-WSDL mappings and SOAP messages bindings. We will use Spring with JAX-WS for writing Contract Last Web Services
  • Contract First - You write/defines XSD/WSDL and then write the implementation. Spring-WS has complete support for implementing Web Service though Contract First development approach. This is the preferred approach. Lets examine why this is the preferred approach :
  1. XML is a hierarchical language where as Java is Object Oriented thus it becomes tricky and hard to manage when implementing inheritance or when using Java Data Structures
  2. Unportable types. All systems may not support similar data types like TreeMap
  3. When implementing Cyclic graphs, where a child has reference to parent and parent has reference to child.  
 
We will look at how to implement the web service in both approaches, Contract First and Contract Last.
 
Web Analytics