Once you get used to programming spring web services, it will be as easy as coding a JAX-WS based framework. After enjoying soap web service development with Spring, I decided to make my own article that will get up and running spring web services from contract to security.
I assume that you have already gone through Part 1 of spring web services documentation, especially the Chapter 3 of the reference.
The example in this article is a CRUD like application using SOAP Spring web services.
It uses JAXB2 un/marshalling and WSS4j for security. The web service can only be accessed by authorized users. A soap fault becomes a response when somethings wrong with the operation such as missing Id, person not found from the server. Here’s where we start our contract first approach, the data contract.
The example uses the following libraries: Spring 2.5.6 Spring WS 1.5.9 jdk6 runtime The ide used was Eclipse 3.5.1 with springide pluggin. Unauthorized users cannot perfrom any of the service operation. The wsdl contract can be happily generated by Spring’s Default Wsdl11Definition later.
To keep things simple, we’ll use an in-memory Map datasource instead of a database. There are many tools out there to generate schema from xml such as Trang command and XMLBeans’s ints2xsd.
I have developed web services using the so called easy way, which is the code first approach.
In this kind of technique, the xml schema and the wsdl are generated by the framework.
The ones I’ve used were Metro web services and Apache CXF. It was so easy to use that you simply use annotations, deploy it to a web server, then … There goes the xml schema and the wsdl generated on the fly. It too works very well with a client generated by wsimport from the command line.
When I got a break, I checked out Spring web services which uses the conract first approach.
Contract first web service approach is an industry standard best practice when developing web services.
Honestly speaking, spring web services was a lot harder to learn that JAX-WS based frameworks.
It requires knowledge of SOAP, xml schema, xml frameworks, and marshallers.
Despite the learning curve, the reward is so rewarding.Tags: Adult Dating, affair dating, sex dating