• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

SCEA assignment query

 
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 462
Scala jQuery Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 52
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 462
Scala jQuery Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 52
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Usually DAO pattern is used to access datasource to perform CRUD operations from the database.Can it be used to call web service?
 
Ranch Hand
Posts: 133
Eclipse IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
 
Will Myers
Ranch Hand
Posts: 462
Scala jQuery Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It's up to you, it's your design.
 
Ranch Hand
Posts: 68
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I used the adapter pattern.
 
Ranch Hand
Posts: 103
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
 
Kumar Amit
Ranch Hand
Posts: 103
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
Posts: 462
Scala jQuery Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 68
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Ranch Hand
Posts: 103
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 103
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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?
 
Bartender
Posts: 1104
10
Netbeans IDE Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
There is a JEE pattern called 'Web Services Broker'. You might want to take a look in the catalog page.
 
Kumar Amit
Ranch Hand
Posts: 103
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
 
Ranch Hand
Posts: 192
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Bartender
Posts: 361
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Ranganathan Kaliyur Mannar
Bartender
Posts: 1104
10
Netbeans IDE Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
Posts: 1104
10
Netbeans IDE Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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.
 
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
So the final conclusion is webservices can be accessed by SLSB directly, by just using a DAO. Right?
 
ananthakrishnan ramachandran
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 361
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 1104
10
Netbeans IDE Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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...
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic