tags:

views:

85

answers:

1

I am new to Weblogic and J2ee. I need to build a webservice that simply runs a query on the backend database (DB2 zOS) and returns the results. Being new to this I have a few questions.

1) What is the best way to build the webservice? 2) How do I connect to the database with weblogic. 3) Is there a way to cache the data returned so that the next request for the same data is pulled from cache?

I googled for this but there seems to be many way to handle this. I am looking for the best way that can handle a high volume of requests.

Any links to sample code would be helpful. - Thanks .

A: 

I'd break the problem into pieces. Forget about the fact that you want to deploy this as a web service. Start with the database connection part first.

You'll need JDBC. Start with a Java interface and define what you want as inputs and outputs. Write an implementation as simply as possible. Get it compiling, running, tested, etc. and put it aside.

Now that you have the database part sorted out, you'll just need to deploy it as a web service.

If you're using REST, it's just a servlet that will have a reference to your database interface. You'll have to get unmarshall parameters from the HTTP request to pass to your database interface. The servlet will then marshall the returned value from the database interface into an HTTP response.

If you're using XML and/or SOAP, I'd recommend starting with an XML request/response definition. Then write an object that maps the XML request to the objects that your database interface needs and the returned objects to the XML response.

Deployment is another matter. You'll package all of it into a WAR and deploy it to your WebLogic domain. You'll create the domain in the admin console and set up the JNDI data source connection pool there.

It's a big problem for someone who's just starting with Java EE.

duffymo