my dog learned polymorphism*
The moose likes Architect Certification (SCEA/OCMJEA) and the fly likes SCEA assignment query 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 "SCEA assignment query" Watch "SCEA assignment query" New topic
Author

SCEA assignment query

ananthakrishnan ramachandran
Ranch Hand

Joined: Jan 24, 2011
Posts: 52
Hi,

Suppose the application is communicating with external system (through web services) which controls all the information to be displayed to the user,in that case we cannot use DAO in the class digram since the data is coming from the external system.How to show this flow in the class diagram?


regards
R.Ananthakrishnan
Will Myers
Ranch Hand

Joined: Aug 05, 2009
Posts: 319

Why can't you use a DAO? They are not limited to databases and I'm assuming you intend to have a class that sits between the web services and the presentation tier or are you planning on calling the web sefvice direct from a jsp/jsf page?
ananthakrishnan ramachandran
Ranch Hand

Joined: Jan 24, 2011
Posts: 52
I am planning to call the web service from business tier like stateless session bean.This stateless session bean will invoke the web services to fetch the information and build the required entities to be used in the presentation tier.Is it the correct approach?
Will Myers
Ranch Hand

Joined: Aug 05, 2009
Posts: 319

I have done something similar but added a class between the session bean and the web services to handle the object creation and the talking to the web services, I have called it a facade but it could just as easily be called a DAO. I have done it like this to seperate the business and integration tiers.
ananthakrishnan ramachandran
Ranch Hand

Joined: Jan 24, 2011
Posts: 52
Usually DAO pattern is used to access datasource to perform CRUD operations from the database.Can it be used to call web service?
Krzysztof Koziol
Ranch Hand

Joined: Nov 19, 2006
Posts: 133

will myers wrote:I have done something similar but added a class between the session bean and the web services to handle the object creation and the talking to the web services, I have called it a facade but it could just as easily be called a DAO. I have done it like this to seperate the business and integration tiers.


Assuming that we are accessing JAX-WS endpoint could we just use SLSB and declare a reference to web service via @WebServiceRef in it?
Is described facade really needed?

Regards,
Krzysztof


SCJP 5.0, SCWCD 5.0, SCBCD 5.0, SCEA/OCMJEA 5.0
Will Myers
Ranch Hand

Joined: Aug 05, 2009
Posts: 319

It's up to you, it's your design.
Ionut Bucurescu
Ranch Hand

Joined: Dec 19, 2006
Posts: 68
I used the adapter pattern.


SCJP 1.4, SCBCD 5.0, SCDJWS 5.0, SCEA5
Kumar Amit
Ranch Hand

Joined: Aug 13, 2001
Posts: 103
Ionut Bucurescu wrote:I used the adapter pattern.

Hi Ionut,
Can you explain how did you used adaptor pattern and where did you injected @WebServiceRef


SCJP, SCJD, SCEA
Kumar Amit
Ranch Hand

Joined: Aug 13, 2001
Posts: 103
will myers wrote:I have done something similar but added a class between the session bean and the web services to handle the object creation and the talking to the web services, I have called it a facade but it could just as easily be called a DAO. I have done it like this to seperate the business and integration tiers.

Hi Will
If you used a facade between the session bean and web service proxy/stub then did you do dependency injection in session bean using @WebServiceRef or in Facade itself? I reckon DI can be done with EJB container managed components/objects only.
Will Myers
Ranch Hand

Joined: Aug 05, 2009
Posts: 319

I have not mentioned any dependency injection in my class diagram other than to mention that it is handled by the standard plumbing code, as is logging, exception handling, and configuration - see Cade's class diagram example.

In Cade's book it says to focus on the "what" not the "how", to my mind dependency injection definitely falls into the "how" category.
Ionut Bucurescu
Ranch Hand

Joined: Dec 19, 2006
Posts: 68
You don't have to use the @WebserviceRef annotation in the adapter since is not a managed class. You can instantiate the generated web service client proxy. I used the adapter to convert whatever external interface to the interface expected by my system.
guru prasanth
Ranch Hand

Joined: Aug 20, 2009
Posts: 96
Is there any purpose of calling session bean calling webservice?This is because the application server would control the instance creation of session bean.Which means application server wouild control the calls made to webservice.If this is desirable then this design shouild be fine.Is your webservice transactional or not.If it's transaction then you need to think because then app server will control transaction as well.You need to think about exception handling also.

But if i have to encounter a situation like this then i would call webservice in Business delegate rather than in session facade.I will have a service locater call to webservice and use these calls in business delegate where i can do a better job of handling exception.
Kumar Amit
Ranch Hand

Joined: Aug 13, 2001
Posts: 103
Ionut Bucurescu wrote:You don't have to use the @WebserviceRef annotation in the adapter since is not a managed class. You can instantiate the generated web service client proxy. I used the adapter to convert whatever external interface to the interface expected by my system.

HI Ionut,
Which pattern did you use to lookup the endpoint of the service in the adaptor is it service locator?
Ranganathan Kaliyur Mannar
Bartender

Joined: Oct 16, 2003
Posts: 1076
    
  10

Hi,
There is a JEE pattern called 'Web Services Broker'. You might want to take a look in the catalog page.


Ranga.
SCJP 1.4, OCMJEA/SCEA 5.0.
Kumar Amit
Ranch Hand

Joined: Aug 13, 2001
Posts: 103
Ranganathan Kaliyur Mannar wrote:Hi,
There is a JEE pattern called 'Web Services Broker'. You might want to take a look in the catalog page.

Web Service Broker Pattern is to expose a business service as a web service and not for consuming a web service
John Lincoln
Ranch Hand

Joined: Feb 11, 2003
Posts: 192
Amit,

I think there is no need of any pattern for getting the url of web service. I think you have a business delegate class, which has the logic to call the web service proxy.

The service end-point of the proxy can be driven through properties file. In real world you can build a project specific to environment or configure the url via admin process

Please let me know if you think otherwise
Sharma Ashutosh
Bartender

Joined: Apr 06, 2001
Posts: 346
In my case, I simply had a interface and it's implementation was WS client which was invoking external webservices. I provided the UML notes stating that i am not showing the generated classes, JAXB related classes or any parsing related classes.

For endpoint SEI-in the real projects-i generally use properties file(one for each environment-dev, ist, uat, prod).

IMHO a lot of people are unnecessarily embedding a lot of design patterns to impress the evaluators-let some simple problems has a simple solution rather than adding more patterns and more layers(i hate simple systems which are over architect-ed or over designed). If there are design patterns there are good number of followers for anti-patterns.


Ashutosh Sharma
SCJP 1.2, SCEA 5, Brainbench certified J2EE Developer, Documentum Certified Professional
Blog : http://scea5-passingpart2and3.blogspot.com/
Ranganathan Kaliyur Mannar
Bartender

Joined: Oct 16, 2003
Posts: 1076
    
  10

Kumar Amit wrote:Web Service Broker Pattern is to expose a business service as a web service and not for consuming a web service


Thats right. My post was wrong. In that case, we can simply name it as a 'DAO'.
Ranganathan Kaliyur Mannar
Bartender

Joined: Oct 16, 2003
Posts: 1076
    
  10

Sharma Ashutosh wrote:IMHO a lot of people are unnecessarily embedding a lot of design patterns to impress the evaluators[/b]-let some simple problems has a simple solution rather than adding more patterns and more layers


I agree. We should look if patterns can solve our problem better. Instead, in the exam pressure, we start looking how to fit-in the patterns into our diagram.
Gurukant Desai
Ranch Hand

Joined: Apr 07, 2008
Posts: 56
So the final conclusion is webservices can be accessed by SLSB directly, by just using a DAO. Right?
ananthakrishnan ramachandran
Ranch Hand

Joined: Jan 24, 2011
Posts: 52
I think DAO can be used to access webservice as it is part of integration tier.It is standard pattern used to access information from any external system.In Cade's book also, they have mentioned DAO in integration tier , which is used to interact with the external system.
Sharma Ashutosh
Bartender

Joined: Apr 06, 2001
Posts: 346
When you are accessing the external Web services from the WAR or EAR - generally you are accessing it via the WS client.
Client could be anything:
1) Stand alone client - mostly for testing purpose
2) Servlet
3) SLSB

My point is at the Business layer, program will try to access the data-either it is coming from DB(here DAO is a better pattern) or Web Services-here you will make use of the WS client*. So why you want to go till DAO or integration tier to call WS?

This call should originate from Business tier or presentation tier.

Somehow i am not very much convinced to use a DAO to access the WS in this case at least.

*Data could be coming from other sources also.
Ranganathan Kaliyur Mannar
Bartender

Joined: Oct 16, 2003
Posts: 1076
    
  10

Well...if you have more than one system to access to, like its in Chapter 9 of H.Sheil's book, then it would be a good idea to have separate DAOs...otherwise I end up having the code that accesses different system in the same place - just too much of cluttering...
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: SCEA assignment query
 
Similar Threads
jsp and external java file
Using css classes in external javascript file?
why a class can't declare it as static ?
external system dependencies in class diagram
does web service proxy go in Integration Tier?