开发者

Java Web Service Oracle

I have a oracle database with a table tha contains user. I want to create a web service in java to get a开发者_如何学Python user by id. How i do this? I search in the internet but i only get Hello World Tutorials.

Thanks


I would suggest you use Spring-WS they have a few good tutorials and a few good sample applications that you can modify to meet your needs. You can find out more at :

http://static.springsource.org/spring-ws/sites/2.0/

You have to do a few different things:

  1. You should write a simple wsdl to define your web service. This may also require you to write some xml schemas. You can find some examples here: http://www.w3.org/2001/03/14-annotated-WSDL-examples.html. Remember wsdls are simply a description of the webservice you intend to write.

  2. The next step is actually write the web service. This requires you to generate objects that will marshall/unmarshall requests and responses. The SpringWS documentation gives you a few examples how to do that.

  3. Finally you need to write the database level calls.


You really have two problems here:

  1. How to query an Oracle database to get records from the user table for a given id.
  2. How to expose that method to web clients as a web service.

You don't say whether you want SOAP or REST.

I'd recommend Spring for both. Its SimpleJdbcTemplate will make task 1 easy; Spring web services will make it easy to write a contract first SOAP service.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜