views:

41

answers:

1

I want to encapsulate every resource from the client application with only one web service which can use my classlib.

I'm confused to access to other resources (web services, databases...) from the class library. Because i think ClassLib should only have classes to reach objects within hierarchy, calculate some things etc. If i set database queries or method calls from library i will have to maintain its connection strings etc...

What kind of an architecture should i use? alt text

alt text

+1  A: 

There is nothing wrong with this approach, you are refering to a service facade. You are going to have to maintain connection strings somewhere, why not on your web-service.

You may want to take a look at WCF services also

http://msdn.microsoft.com/en-us/library/bb332338.aspx

http://msdn.microsoft.com/en-us/library/aa480190.aspx

Richard Friend
Actually I can code it with dotnet but i want to make this with java (this will be my first java project)
uzay95
You are right about Facade pattern. But Should class reach to databases?
uzay95
I would abstract each system into into its own library and test these indivdually, then loosely couple these together into a service facade, maybe using dependancy injection..
Richard Friend
@Richard, I'd like to clarify this problem little better. I have classes like patient, test, clinic which are inter-connected.Therefore separating them is not easy. I am trying to build good, secure, efficient architecture. This is why i need to take a bunch of web services to the front. But i can't get myself to accept that there can be a way that a class lib can have a web references in itself.
uzay95