This demo shows how to create RESTful services using CXF's HTTP binding
This demo shows how to create RESTful services using CXF's HTTP binding.
The server in the demo creates 3 different endpoints: a RESTful XML
endpoint, a RESTful JSON endpoint, and a SOAP endpoint.
[RUNNING THE DEMO]
The demo has a class called com.acme.customer.Main which starts up various
endpoints. To start this server run the command:
$ ant server
Once it is running try going to the following URLs:
These will serve out XML and JSON representation of the resources.
There is an HTML page that is served by CXF so you can try using the
Included are some example JSON and XML files so you can add or update
customers using wget. Try the following commands and look at the results:
wget --post-file add.json http://localhost:8080/json/customers
wget --post-file add.xml http://localhost:8080/xml/customers
wget --post-file update.xml http://localhost:8080/xml/customers/123
And if you are interested in SOAP you can try the SOAP endpoint:
[RUNNING THE CLIENT]
The demo also includes a Client class which accesses data using
HTTP. To run this demo, do:
$ ant client
XFire-CXF-restful_http_binding.zip( 19 k)
Related examples in the same category