• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

DAO to access to web service?

 
Víctor García
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What is the pros and cons ?
 
Deepak Bala
Bartender
Posts: 6663
5
Firefox Browser Linux MyEclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ?
 
Víctor García
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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
Posts: 6663
5
Firefox Browser Linux MyEclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 109
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've used a Stateless bean functioning according to Proxy pattern to hide connection establishment and other ws-related stuff
 
Deepak Bala
Bartender
Posts: 6663
5
Firefox Browser Linux MyEclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 109
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 109
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 224
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Víctor García
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic