File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Architect Certification (SCEA/OCMJEA) and the fly likes Design pattern to consume an existing web service Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Architect Certification (SCEA/OCMJEA)
Bookmark "Design pattern to consume an existing web service" Watch "Design pattern to consume an existing web service" New topic
Author

Design pattern to consume an existing web service

Jomon George
Greenhorn

Joined: Aug 03, 2010
Posts: 16
Hello friends,

What would be an appropriate J2EE design pattern to interact with existing system which offers Web Service interface? Does this scenario necessitate the use of a design pattern?

Thanks,
Jomon
Anil Chowdary
Ranch Hand

Joined: Jan 20, 2009
Posts: 43
I think it would be some kind of utility class I suppose.

The below link has the some information:
webpage

You can name it as some DAO as it is getting/sending data from/to a source, which is a web service in this case. I read some article and they have mentioned that a DAO is not necessarily used to get data from a traditional data source like Oracle DB. It can also interact with Db for information access.

Thanks & Regards,
Anil Chowdary K


OCMJEA/SCEA, SCWCD, SCJP
deepak adlakha
Ranch Hand

Joined: Jul 27, 2001
Posts: 325
Well, IMHO i dont find it as good option to use DAO as the naming convention. But that's my personal opinion.

Coming back to the original question :-
"Web Service Broker" Design pattern is meant for this purpose only ? isn't ?
Anil Chowdary
Ranch Hand

Joined: Jan 20, 2009
Posts: 43
Web Service Broker is for exposing a service. I dont think it is for consuming a service
deepak adlakha
Ranch Hand

Joined: Jul 27, 2001
Posts: 325
Correct, I refered back my notes. its for exposing and not accessing. Thanks for the correction.

Jomon George
Greenhorn

Joined: Aug 03, 2010
Posts: 16
Thanks for the comments...
I decided to use a DAO class which will abstract the calls to the existing Web service system...What do you think?
Rahul Mishra
Ranch Hand

Joined: Jan 22, 2006
Posts: 211
I am working on an assignment (big smokes) which entails a similar concept, abstracting a web service behind a DAO is a good idea..because by definition a DAO is a data access object and data could be accessed from anywhere (Mainframe, Web Service, Database).

I have used this pattern in real life projects and it works really well...not when it comes to sun exam..not so sure


OCMJEA/SCEA, SCDJWS, SCBCD 1.3, SCJP 1.4
My SCEA experience:http://javalogue.blogspot.com/
Jomon George
Greenhorn

Joined: Aug 03, 2010
Posts: 16
As a second thought, considering performance reasons, I plan to consume/integrate web service in the presentation tier by using a POJO client class.
wolfgang unger
Greenhorn

Joined: Oct 30, 2010
Posts: 28
I think a adapter fits perfect.
You don't want to change your business logic or frontend, if the web-service interface changes in future...this way you provide
a interface that won't change, if the webservice may be replaced by another technology.


Senior Consultant/Software Architect
SCJP, SCEA
facebook: JEE Java Enterprise
Alexandre Delalieu
Greenhorn

Joined: Oct 06, 2010
Posts: 13
Adapter if you need to change the interafce or proxy of you need to add functionalities I guess.
Jomon George
Greenhorn

Joined: Aug 03, 2010
Posts: 16
Thanks Alexandre and Wolfgang !
Do you think that integrating web services in presentation layer makes sense?
Alexandre Delalieu
Greenhorn

Joined: Oct 06, 2010
Posts: 13
Jomon George wrote:
Do you think that integrating web services in presentation layer makes sense?


I don't think so except if you are using a rest/ajax architecture
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Design pattern to consume an existing web service