In this entry, I'm about to show how easy it is to create a web service using Spring-WS using annotations. Spring-WS makes it very easy to publish webservices so that you can publish your already existing services. It is based on JAX-WS, so it is great for application servers like Weblogic, since it uses the same web service technology stack.
To create a Spring-WS based web service, we just need to implement one class: the endpoint. By the way, since we are using Spring, usually it'd be better to implement the logic for the web service in its own service class, so that's the way we're going to take...
To create the enpoint class we just need to create a class extending org.springframework.web.context.support.SpringBeanAutowiringSupport and annotated by javax.jws.WebService. Once we have this class, any method representing an operation in the service, will have to be annotated by javax.jws.WebMethod.
Supose we want to publish a web service called GreetingsService with an operation sayHi. In this case, we'd create the following endpoint class:
Of course, we're not going into details about the GreetingService definition nor into how to configura my app to use Spring.
If we package and deploy this service, the url http://localhost:7001/springws-sample/greetingsService?wsdl (I'm currently using Weblogic), will return the following WSDL:
In the following entry, I'll explain how add a handler to the web service so that we can, for example, extract the user from a SAML token sent within the request to the web service,