Wednesday, November 24, 2010

Mocking Web Services

SOAP UI contains a mock service generation utility.

Is it worth using it?

Luciano says:

I have used them, and for me they are complicated to maintain (we had some 20 SoapUI Mocks and it was a pain in the neck to update and deploy them to Win and UNIX).

Another problem with the mock SoapUI is linked to the fact that if you change the WSDL you realize the problem only at runtime. For us it was a problem because the WSDL would change weekly, maybe not your case.

Finally, on my advice, we've moved to "normal" Web Services deployed in a dedicated EAR. In doing so we obtained the following advantages:

- Easy to deploy (the deploy was carried out directly by Hudson, during the normal deploy the application)

- The business logic of the mock can be more sophisticated, since it's all in Java

- The mock were compiled during the normal build procedure of the project, so we could detectd problems in the WSDL at build time - rather than runtime.

The infrastructure that I had set up allowed to create a web service from a WSDL with a simple command Gradl, so the migration to "mock Java" was a matter of 3 hours work.

If you have a mock or two, with a WSDL that never changes and one environment and deploy a simple business logic, use SoapUI. Otherwise consider creating a dedicated web service.

No comments: