How to provide an API for our system
I didn't have much experience with Webservices or APIs.
We have a site based on Oracle platform-> Sun App Server-> Java-> Struts2. We have a requirement to provide an API for our system. This API will be used by other systems outside of our system. The API is just a simple SP that we have in our database. Another system does not want to connect to our DB to access the JV, but instead the API as a "web service"
Can the community shed some light on how to do this? Will the API be put on our web server? is how the other system connects to it? And how do you create a public API?
a source to share
If you are using the Sun App Server, it should be pretty trivial to make the EJB open as a web service with the @WebService tag, then include the EJB in the Store and return the data. Application Server provides you with WSDL publishing tools that they will use to know what to call you an API.
Saying that it sounds easy at 50,000 feet, it's a real pain to deal with all the details. First, what about security? Second, do we really need WebServices, or is there a clearer communication mechanism like (at least) REST, if not some simple servlet transfer. And the tricky part: in what format will you return this result set?
Anyway, you can deal with political football here ("what, you don't know how to make web services, everybody knows it, etc."), so it can be a little tricky to research the requirements. The good news is that publishing a web service is pretty trivial in the latest Java EE (much easier than consuming). The bad news is the details are going to be killer. For example, experienced web service developers spend hours on namespace issues.
a source to share
Some things you need to think about are the following:
- SOAP vs REST ( Why use REST instead of SOAP based services? )
- How will you handle authentication?
- Do I need to scale?
You might want to take a look at https://jersey.dev.java.net/ .
It would also be helpful to see how another company is doing this, take a look at http://www.flickr.com/services/api/ for some ideas.
a source to share
Soap or Rest or .. is one side of the coin and depends on what the customers want. Another (more) important thing is the api itself. Should he be stateless or a state. Clients are co-located on the same virtual machine (Appserver) or remotely on the same local network or even on the Wan. Once the connection goes through the wire, it slows down due to serialization. Thus, you want the API methods to be able to receive large (but not too large) chunks of data at a time.
Or, in other words, your question cannot be answered without knowing much more about what you want and need to do.
a source to share