I’ve written an an API giving some methods like
runApp();
stopApp();
doSomethingElse();
currently I have a jar file with which I run these methods.
I want to be able to invoke these method by http.
For example, going to : http://localhost:8080/something/runApp
will invoke runApp() method.
I’ve heard that this should be done with webservices, and particularly REST API.
Is webservices the only way to achieve this?
And if so, can someone summarize the simplest ways to implement this ability, or point me to an existent summary?
Thanks.
Here’s a RESTful API example based on your pseudocode, with JAX-RS:
Which when built and deployed into any JEE5 or JEE6 web capable container will allow you to access services those services at:
Assuming your server is running on
localhost:8080, of course. Having said that, nothing in this example is really RESTful, and would be better implemented using JAX-WS.