• Post Reply Bookmark Topic Watch Topic
  • New Topic

Web Services as Data Access Layer ? (Your thoughts please)

 
Rashmi Banthia
Ranch Hand
Posts: 79
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi!

AFAIK, the advantages of using web services are : interoperable, easy integration and reuse, text based protocols and data formats - SOAP,WSDL,XML.

Also, I read this article: http://www.theserverside.net/articles/showarticle.tss?id=Top5WSMistakes
I completely agree with everything this article says. Is there anyone (or anylink) which proves otherwise? I have read quite a few times about using web services as data access layer, but somehow I don't understand why ?

If I have to design a web based application, accessible only in an intranet environment. Is it a good idea to use web services as data access layer ? For example: for a customer data entry screen - I'll have web services like : getCustomerbyIDWS(), IsCustomerUniqueWS(), AddCustomerWS(), UpdateCustomerWS() etc. It just sounds to me like an overhead to use web services. Appreciate your responses.

Thanks in advance,
Best Regards,
Rashmi
 
Pj Murray
Ranch Hand
Posts: 194
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What you're proposing seems to be providing a Web Services (i.e. SOAP) interface into a database.

This is certainly possible - I've seen it done a few times.

You're going to need a little bit more that a data access layer.

An incoming SOAP message needs to be converted into RMI (using a SOAP stack - protocol coverter like Cape Clear). This is passed to the data access/ persistence tier that updates the database. The data persistence layer should be based on Data Access Objects (DAOs) and there's a wide variety of technologies available (JDBC, JDO, Hibernate, EJB CMP).

The good news is that there's tools available to generate everything you need. Tools lkie FireStorm/DAO generate DAOs directly from a database schema. The DAO classes are stateless services that can easily be exposed as transactional Session Beans and are also suitable for use as part of a Web Services architecture. There's lots of tools available to generate WSDL from Java classes, such as Cape Clear.
 
Roger Chung-Wee
Ranch Hand
Posts: 1683
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It just sounds to me like an overhead to use web services.

I would certainly agree. To use web services for an intranet application as you have described is complete overkill, in my opinion. You will add cost and complexity to the appplication for no benefit - indeed, it will run slower than every other solution I can think of.

Remember, web services can be a good solution for inter-system communications. In my company, we are use web services for interfacing applications written inhouse, partly to decouple them from each other.

But I've seen applications where web services was used internally, and I could see no benefit at all. For these applications, what's wrong with passing objects around? And if the client is remote, then RMI or EJB (which uses RMI-IIOP) would often be best.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!