• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Unit Testing Web Services

 
Rakesh Jhamb
Ranch Hand
Posts: 154
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello All,

We have a project that uses JAX-WS and JAXB for webservices.
We want to write Junit Test cases for testing web services.

The client side i.e. Junit will need stubs to be generated to test the actual web service using tool wsgen. We want to automate this process of generating stubs in a standard manner using Ant Build script.

Can anyone share a sample build script that is generating these artifacts. Please share the same.

Also share a standard practice for unit testing web services.

Thanks
 
Aditya Kumar
Ranch Hand
Posts: 102
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Also share a standard practice for unit testing web services.


Basically ours are text/xml based webservices -- meaning that the response we expect does not contain binary data. For unit testing this we use a simple Http Request/Response client. We feed this client with the URL of the webservice and the request XML and that is fired over an HTTP connection to the URL. The response XML is then displayed and we can compare it to what we expect it to be.

It would be insightful to know how the developers go about testing their web services...
 
Martijn Verburg
author
Bartender
Posts: 3275
5
Eclipse IDE Java Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There are some good resources that you can Google on this including:

Dr Dobbs article

WSUnit - A JUnit for web services
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic