• 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

Design Pattern To Migrate BL As Web Services

 
Ranch Hand
Posts: 111
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello all,

I am working on enterprise application that is build using GWT, Struts 2 and Hibernate 3. I am following complete MVC architecture in which I have presentation in GWT, Action layer in Struts 2 used by client, BL as Facade layer used by Action layer and persistence layer used by facade layer. Now I want to expose my facade layer methods as web services as soon as possible and that in maintainable and scalable manner.

I am not having much knowledge regarding web services or J2EE design patterns. I have heard about Axis framework but don't have much knowledge about that. Kindly suggest which are good frameworks which I can use to expose web services and which pattern will be good to use in this case.

 
Ranch Hand
Posts: 2187
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Now I want to expose my facade layer methods as web services as soon as possible and that in maintainable and scalable manner.



Why do you want to do this? If you don't have knowledge about web services, it is hard to understand how you know that this is what you want. Very confusing.

Anyway, web services are for connecting applications. It is an integration technology, not an implementation technology. So, are there other applications that you want to the be able to communicate with the one you are currently working on?

Axis is a good framework to create web services.

In regards to patterns, you first need to identify what type of web service you want, e.g. data-centric, process-centric, functionality-adding, etc.
The Facade and Adapter pattern are helpful once you know what you are doing.
 
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Why not just continue to use your Struts 2 layer to expose services? Creating RESTful services using the technology you already have in place would be pretty straight-forward. Or, if you're already using Spring integration, consider its support for services.

Assuming your application is already reasonably partitioned, it's usually a matter of taking your existing services and creating a minimal service request wrapper around them. Blindly seeking patterns to apply to the problem is premature--doesn't look for patterns, find them.
 
Vish Shukla
Ranch Hand
Posts: 111
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

If you don't have knowledge about web services, it is hard to understand how you know that this is what you want. Very confusing.



Sorry for confusing statements. What I want to convey is, I am clear in basic concepts of web services but haven't worked on it practically ever and don't have in-depth knowledge of concepts also.

I don't need to communicate with other application but due to new deployment requirement, Web server and BL layer need to be separated. So I decided to expose BL layer methods as web services. The application is in half developed state, so I was looking around for some smart way so that there will be minimal changes in the consumer of web services.

you first need to identify what type of web service you want, e.g. data-centric, process-centric, functionality-adding, etc.


Again I haven't heard of any of these type of web services. Trying to give you idea about what exactly these web-services will do is abstracting business process, delegating calls to dao layer for CRUD operations, making decisions for workflow (just because of dynamic behaviour of workflow.).

Why not just continue to use your Struts 2 layer to expose services?



I am not sure whether it will be possible to separate web-application deployment and BL layer deployment with this approach? One more doubt is that As I am using GWT layer as front-end, most of the server calls are AJAX calls. So will there be any issues because of that? It would be great if you put some more light over these issues or suggest some tutorial for the same.

 
David Newton
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The type of call made to Struts isn't relevant--what's important is what you need back. Considering that there's trivial support for returning JSON, XML, or XHTML, I'm not sure where the confusion is.
 
Jimmy Clark
Ranch Hand
Posts: 2187
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Vish, first you are using the letters 'BL' to mean something. Is this some acronym that you just made up? Please use English words instead. This
will foster better understanding for readers with English as a second language.

I don't need to communicate with other application but due to new deployment requirement, Web server and BL layer need to be separated. So I decided to expose BL layer methods as web services.



Assuming that your 'BL' means business logic, a lot will depend upon how this is implemented. Is it a group of plain Java-based objects, or is it a group of Session EJB? Either way, separating these two components is not a mystery nor something new.

I think you need to learn more about web services. More about the problems with them and the overhead and the maintenance. You seem to have made a pre-mature decision to use a technology that you don't understand, in my opinion.

Also, it looks like you could benefit from learning about Session EJB (remote connectivity), JNDI and the Business Delegate design pattern.
 
Vish Shukla
Ranch Hand
Posts: 111
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
James, you are right, I have used BL as acronym for Business Logic. I haven't used EJB, this layer has plain java-based objects only(not beans).

I think you need to learn more about web services. More about the problems with them and the overhead and the maintenance. You seem to have made a pre-mature decision to use a technology that you don't understand, in my opinion.



I am here only because I need to learn many things in that. Any ways, I want to finalize on which technology/patterns to use which I need to do in very less time, so my thought was if I can get couple of directions which can solve my problem, it'll save a lot of time.

If prime requirement is for separate only, and Web server & application server are going to be in intranet, can session-bean solve the issue? Can you please suggest some book where I can get overall idea of technologies and which can give me knowledge to make right decision.
 
Jimmy Clark
Ranch Hand
Posts: 2187
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

If prime requirement is for separate only, and Web server & application server are going to be in intranet, can session-bean solve the issue? Can you please suggest some book where I can get overall idea of technologies and which can give me knowledge to make right decision.


Assuming that your use of the term "separate" means on different machines using different JRE instances, then yes, Session EJB can provide a solution. A RMI server can also provide a solution. Any book about Enterprise JavaBeans or RMI will help.


 
Vish Shukla
Ranch Hand
Posts: 111
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks a lot James..

Just want to confirm one point.. Will it matter if my web tier server and business logic tier server are on same Intranet or on different network in Internet?
 
Jimmy Clark
Ranch Hand
Posts: 2187
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


The terms "intranet" and "internet" represent different things.

It will matter slightly. "dedicated" communication over the internet will be slightly more complicated and the non-functional requirements would be different. However, machines have been communicating via internet for over 40 years. I suggest initial study in RMI and then move into Enterprise JavaBeans. Also, it looks like you need to learn a bit about about network programming (Socket programming in Java).
 
Vish Shukla
Ranch Hand
Posts: 111
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
James, I think I was too lazy in typing in last post.. My last question was related to Enterprise JavaBeans only. I meant if I am going for EJB, then EJB server should be on the same network in which Web server is located? If its not necessary that they should be on same network, then what kind of "complication" it will add if they are on different networks on internet.?

 
Jimmy Clark
Ranch Hand
Posts: 2187
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This goes back to what you meant by "separate". If the web application is on a totally different network than the EJB application, then creating web services to allow these two applications to communicate is a good design decision. These would be classified as process-centric services.

In regards to the alternative, you would need "dedicated" and "secure" connections between the two networks to enable them to communicatie via TCP/IP protocol. You would need to set up comprehensive firewall (DMZ) systems in both networks.

If the web application and the EJB application are hosted on different machines, BUT, in the same network, then setting up web services to enable them to communicate is not a good design decision, in my opinion. This is base on my limited understanding of your organization, your industry, and what your application actually does.
 
Vish Shukla
Ranch Hand
Posts: 111
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
James, Thanks for really nice explanation. I am not able to give you exact requirement is because this application is a product which will be deployed to n different clients. So there is possibility that these server will be on different networks. So I think I need to find out probability that what is more possible requirement. And there is trade-off in both the solutions as it will vary in each deployment.

Can you give your suggestion for how severe it is to use web service in "Intranet architecture"(Sorry for laziness again in writing whole sentence here) and how severe impacts will be there in using EJB in "architecture with different networks".
 
Vish Shukla
Ranch Hand
Posts: 111
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Finally, got the missing link from other sources.. Just for other readers' information, when using EJB for remoting, it doesn't matter whether its on intranet or internet. Its just that if there are proxies or firewalls, you need to do security related compromises. In which case, you can always expose SessionBean as web service which will work through Port no 80 and uses HTTP.

Thanks to James, David & JavaRanch for help...


 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic