Thursday, October 15, 2009

Spring, Web Services and Functional Testing

Functional tests are particularly interesting for web services as they allow to test a fully integrated web service stack from the outside, thus giving the same point of view of the clients. In a sense, what really matters in a web service is its interface rather than its implementation, and functional testing allows to focus on that.

In this post I'd like to present an automated way to implement functional tests for your web services using Spring. The approach relies mainly on Spring TestContext Framework, an embedded Jetty instance and Spring Web Services (you saw it coming, didn't you?).
The outline is as follows: functional tests are implemented using Spring TestContext and JUnit 4 (or any of the other supported testing frameworks). In the ApplicationContext that Spring TestContext creates for the test, we include an embedded Jetty instance that loads and runs the target web service application. The actual test consists simply of invoking that web service through a WebServiceTemplate (Spring-WS) and validating the response with XMLUnit. Finally, we run our tests using Maven (mvn test, simply).

Friday, October 9, 2009

WS-Security Support in Spring-WS Grails Plugin

I've been busy lately working on adding WS-Security support to the Spring-WS Grails plugin and I'm pleased to tell you that we're just about to release a new version containing that work. When I first learned about the plugin from Russ Miles, I was pretty excited I must say; the perspective of bringing together Grails and Spring-WS opens up a whole new world of possibilities. The goal of the Spring-WS plugin is to make developing contract-first web services easy and productive, and to that end, we wanted to provide an easy way to add security to your endpoints, based on a convention-over-configuration approach and on other niceties that Groovy offers.

Monday, September 7, 2009

A New Place for CAFEBABE

I've just moved my blog to Blogger with a new domain name: I also migrated all the articles from the old location so nothing is really lost, except maybe some of the nice comments I got there. Thanks to Feedburner my feed's url remains the same too.
So why did I do that? Blogger is really a cool and lively platform and my hope is that it will offer my blog a better ground.
Thank you for taking the time to read my blog and I hope that you like its new incarnation. Stay tuned for more to come :)

Monday, August 3, 2009

Make Grails Object Marshalling More RESTful

If you use Grails to develop RESTful services, then you're probably familiar with the different ways of producing XML and JSON representations for your objects. One particularly convenient option is to make use of the provided converters, along with the render method.

Wednesday, June 17, 2009

Spring Integration and Spring Web Services, a Nice Fit

Spring Integration (SI) introduced support for inbound web services messages recently, meaning that you can define web services-enabled message gateways that accept SOAP (or POX) requests. This feature is provided as an integration with Spring Web Services (Spring-WS), which is a good thing as we will see, and not only because I like Spring-WS.

Monday, February 2, 2009

How to Tell If Your Code is Still Compatible...

... with jdk 1.4, Spring 2.0 or any other version of a framework or a library, after your last code modification? Sounds familiar? I found myself in that situation not so long ago. I was reworking some code with Spring 2.5 specific method calls to restore compatibility with Spring 2.0 and Jdk 1.4. After wading through the java docs and manually checking suspicious calls for a while, I started to fancy a tool that does the job for me; something that answers precisely questions as: what and where are code parts that reference classes or methods introduced in Java 6 and were not present in Java 1.4, for instance.