Skip to content

ruben056/SpringRestfullWSTest

Repository files navigation

SpringRestfullWSTest

What

Spring restfull webservice supporting both XML and JSON as response body.

How to use

Start server

  • run as > run on server -> this did not always seem to work (spring sts exited every time I started the server)

  • I added the maven jetty plugin and now you can can start the app in the jetty webserver with the following maven command:

$ mvn jetty:run

Test using Curl

  • when running on tomcat or you chose run on server
$ curl -u remote:remote -v -H "Accept: application/xml" http://localhost:8080/SpringRestfullWSTest/contact/listdata
$ curl -u remote:remote -v -H "Accept: application/json" http://localhost:8080/SpringRestfullWSTest/contact/listdata
  • when runnin on jetty via maven the context root is not mentioned in the url:
$ curl -u remote:remote -v -H "Accept: application/xml" http://localhost:8080/contact/listdata
$ curl -u remote:remote -v -H "Accept: application/json" http://localhost:8080/contact/listdata  

Test using Springs Resttemplate

  • just run the maven test:
$	mvn test

(restart server for each tests, since delete occurs in db ...)

About

Test restfull services with xml and json.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages