This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Architect Certification (SCEA/OCMJEA) and the fly likes DAO to access to web service? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Certification » Architect Certification (SCEA/OCMJEA)
Bookmark "DAO to access to web service?" Watch "DAO to access to web service?" New topic
Author

DAO to access to web service?

Víctor García
Greenhorn

Joined: May 04, 2009
Posts: 18
Hi,

I access to a web service using JAX-RPC from a SLSB, should i use a DAO to access to the web service? What do you think?

Thanks in advance.
Mateus Brum
Greenhorn

Joined: Nov 28, 2007
Posts: 18
What is the pros and cons ?


Mateus Henrique Brum
Sun Certified Java Programmer 6
Sun Certified Web Component Developer 5
Java Developer - SP - Brazil
Deepak Bala
Bartender

Joined: Feb 24, 2006
Posts: 6661
    
    5

A DAO is supposed to retrieve data and pass around value objects. A DAO implies that a user is working with a persistence. Does the web service have persistence ? If the persistence of the web service changes, how will you handle that ? How do you handle transactions ? Did you think about all these questions ?


SCJP 6 articles - SCJP 5/6 mock exams - More SCJP Mocks
Víctor García
Greenhorn

Joined: May 04, 2009
Posts: 18

The web service don't have persistence, with the web service the application communicate with an external system. I don't manage transactions with the web service, because i think that there isn't a really standar tecnology to work with transactions in web service, is this correct?

My doubt is that the dao is to decouple the tecnology and code for communication with a system from services, but i think that using Jax-Rpc the service only have to call to an interface and therefore i don't need a dao, what doy you think about this?

Thanks for your answers, and sorry for my english.
Deepak Bala
Bartender

Joined: Feb 24, 2006
Posts: 6661
    
    5

You can read up on WS transactions -> http://www.ibm.com/developerworks/library/specification/ws-tx/

You will have to have a pretty strong technical reason to use a DAO to back a web service. I cannot think of one
Dmitri Ericsson
Ranch Hand

Joined: Feb 16, 2010
Posts: 109
I've used a Stateless bean functioning according to Proxy pattern to hide connection establishment and other ws-related stuff


SCEA 5, SCJP 6 My SCEA Experience
Deepak Bala
Bartender

Joined: Feb 24, 2006
Posts: 6661
    
    5

Dmitri Ericsson wrote:I've used a Stateless bean functioning according to Proxy pattern to hide connection establishment and other ws-related stuff


You mean the SLSB acts as a proxy for the WS ?
Dmitri Ericsson
Ranch Hand

Joined: Feb 16, 2010
Posts: 109
yes, right. I've asked a question here about what pattern needs to be used, and proxy was an answer. I've got P overall, but I cannot state that this is the best solution
Víctor García
Greenhorn

Joined: May 04, 2009
Posts: 18
Thanks for your answers...

I like the proxy pattern, i think that is better than dao to call a web service...

Dmitri, have you used WS transactions?

Dmitri Ericsson
Ranch Hand

Joined: Feb 16, 2010
Posts: 109
No I haven't, but in technical risks I've mentioned data integrity and suggested that they may be used if needed. WS transactions is quite a new topic for me, so I didn't go into details.
Sreenivasa Majji
Ranch Hand

Joined: Jul 12, 2001
Posts: 224
Víctor García wrote:
The web service don't have persistence, with the web service the application communicate with an external system. I don't manage transactions with the web service, because i think that there isn't a really standar tecnology to work with transactions in web service, is this correct?

My doubt is that the dao is to decouple the tecnology and code for communication with a system from services, but i think that using Jax-Rpc the service only have to call to an interface and therefore i don't need a dao, what doy you think about this?

Thanks for your answers, and sorry for my english.


Looks like this is a service layer to me, because you are using an external service. I would think interms of service layer pattern. Like somebody mentioned here, proxy will be a good choice.

Sreenivasa Majji
Víctor García
Greenhorn

Joined: May 04, 2009
Posts: 18

Ok, thanks to all!!

In the next two weeks i submit the assignment and i will see if the proxy is a good choice

Víctor García
Greenhorn

Joined: May 04, 2009
Posts: 18

I have another doubt... i think that a proxy object will be in the integration tier... but to have a SLSB in the integration tier is correct?

Mv Caraiman
Greenhorn

Joined: Nov 10, 2006
Posts: 4
Hi,
For me it looks a good case for the Business Delegate pattern. I quote : "The Business Delegate acts as a client-side business abstraction; it provides an abstraction for, and thus hides, the implementation of the business services. Using a Business Delegate reduces the coupling between presentation-tier clients and the system's business services." (http://java.sun.com/blueprints/corej2eepatterns/Patterns/BusinessDelegate.html)

cheers,
MVC
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: DAO to access to web service?
 
Similar Threads
Hibernate loads only first element of the collection
question on search using DAO
SCEA assignment query
Web Service & Hibernate
Web Service & Hibernate