mardi 3 mars 2015

Testing SOAP web service

My first version of the web service used plain JDBC to connect to the underlying database. I had written my Unit tests for the application using JUnit. I deployed this service on Jboss EAP 6.4. So far so good.


I altered my application code to use Jboss's JDBC connection pool. It seems like Jboss 7+ does not let us refer to a data source externally (from outside the server). While the service still works fine , my unit tests are now broken. I am wondering how I can fix this.


I was thinking of re-writing same tests to test the service instead of the application code. One way to do this would be to generate the stubs using wsimport and then write a client. I can then use JUnit to test the client. The problem is one has to manually create the stubs and every time the WSDL changes I would have to generate the stubs again.


I am looking for an efficient way to accomplish this. What would be ideal is a framework that accepts a url for the WSDL (or url to the service) and then allow me to call the service operations.For instance if SOAPUI can be invoked through code then it would be a perfect fit. I am not sure if there is a way to do this.


I am aware that the above is no longer unit tests but integration tests. Is this approach the best way to test a JAX-WS service ?


Aucun commentaire:

Enregistrer un commentaire