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.