WS test client with XPath validation
I just needed a general web service client for testing purposes, which can create a request from an input file, posts it to an endpoint and validates a response if it follows some basic structure. Prefrably all in Java.
Well, I could use some existing tools, eg. soapUI, but I've decided to develop it by myself. It was suprisingly easy, here is a simplified recipe:
1) take the Jakarta Commons HTTPClient
2) add some other Commons stuff like CLI, Configuration, mix it carefully so your HTTP client gets all the needed parameters like endpoint URL, payload etc.
3) POST the request
4) take an XPath engine like Jaxen
5) validate a response by an XPath expression
5) bake it, serve it hot
Enjoy :)
Labels: ws
