• 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

Is it necessary to use statless sessiob bean as proxy to web service?

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

I have finally decided to use a proxy class to integrate a web service with my system. I had gone though the forum and a lot of people earlier used a statless session bean to act as a proxy to a web service. It sound little strange to me for the simple reason that a proxy can be a simple Java class. Any type of web service client(Static proxy/Dynamix Proxy/Dynamic Invocation Interface) you can create as a simple java class. So I'm wondering is there a special advantage of creating it as a stateless session bean?

Thanks,
Anil
 
Ranch Hand
Posts: 264
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
any opinions on this. I'm using SLSB as a web proxy. The reason i have is it would scale better when we have more app servers.
 
Anil Chowdary
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Fair enough. Even I end up using a SLSB for the assignment part.

But in reality, even you make it as a simple class it can still be scalable. If you have the flexibility to increase the app servers, the same applies for web servers. Just a thought.
 
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

Anil Chowdary wrote:Fair enough. Even I end up using a SLSB for the assignment part.

But in reality, even you make it as a simple class it can still be scalable. If you have the flexibility to increase the app servers, the same applies for web servers. Just a thought.



Did you put something between SLSB and WebService?, kind of DAO or Adapter?
 
Anil Chowdary
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes, I have a layer in between by SLSB and the web service. But I didn't name is as DAO. I just called it as <ServiceName>Client. This is a plain java class that acts as client to the webservice.
 
Krzysztof Koziol
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

Anil Chowdary wrote:Yes, I have a layer in between by SLSB and the web service. But I didn't name is as DAO. I just called it as <ServiceName>Client. This is a plain java class that acts as client to the webservice.



As for <ServiceName>Client class, what pattern it represents?. What are the responsibilities of this class?
 
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Why need additional layer? To assemble object from xml? Why can't be implemented in SLSB? So what's in SLSB? Thanks.

Anil Chowdary wrote:Yes, I have a layer in between by SLSB and the web service. But I didn't name is as DAO. I just called it as <ServiceName>Client. This is a plain java class that acts as client to the webservice.

 
Krzysztof Koziol
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

Ethan Zhang wrote:Why need additional layer? To assemble object from xml? Why can't be implemented in SLSB? So what's in SLSB? Thanks.



Finally I decided to use only SLSB as my WS client. I will add it to the integration layer in my Component Diagram.
 
Ranch Hand
Posts: 65
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
so SLSB as the WS client, is actually SLSB as the WS Proxy ?
 
Krzysztof Koziol
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

Luay Abdulraheem wrote:so SLSB as the WS client, is actually SLSB as the WS Proxy ?



If you want to call it WS Proxy. For me it is just a WS client implemented as SLSB.
 
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Anil Chowdary wrote:Fair enough. Even I end up using a SLSB for the assignment part.

But in reality, even you make it as a simple class it can still be scalable. If you have the flexibility to increase the app servers, the same applies for web servers. Just a thought.



Anil,

The coolest thing about using SLSB is the flexibility. Think for example in the scenario that you can deploy the SLSB in another app server. You can thus point to many other clusters of EJBs by IP and not worry about deploying the presentation layer. In that sense it is more flexible than any simple java object.
 
Luay Abdulraheem
Ranch Hand
Posts: 65
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In the component diagram, when we say that our SLSB will be in the business tier or in the integration tier, that means that both (Interface + Bean"Interface Implementation") are considered as one component, right or wrong ?
 
Ranch Hand
Posts: 100
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Krzysztof Koziol wrote:

Luay Abdulraheem wrote:so SLSB as the WS client, is actually SLSB as the WS Proxy ?



If you want to call it WS Proxy. For me it is just a WS client implemented as SLSB.



In my view, if SLSB is the WS client, it should not be called WS proxy. The WS proxy should ideally have a reference to the "real subject" class. To use dependency injection, this "real subject" class should be managed by container. So should this "real subject" will also be SLSB, something like:

@stateless
public class RealWSSubject{

@WebServiceRef
// web service consumer

}

@stateless
public class WSProxy{

@EJB
RealWSSubject realSubjectRef;
// using real subject

}

Am i missing anything ?
 
Luay Abdulraheem
Ranch Hand
Posts: 65
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
mm .. looking back to your example Client and Proxy seem to be different objects. Krzysztof said they are the same, but you can choose the naming of that one object (if I'm not wrong) The question now : it seems to me that there is no need to use an additional layer SLSB WSProxy in your example ? What is the use of it ? can someone please help !

P.S : I haven't worked on a web service client consumer as an SLSB before, thats why I'm asking alot
 
Krzysztof Koziol
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
Guys, I said that SLSB can be used as WS client. There is no need to add other supporting beans.
 
Luay Abdulraheem
Ranch Hand
Posts: 65
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Krzysztof for clearing out some points.

What about both (Interface + Bean"Interface Implementation") are considered as one component, right or wrong ?
 
Krzysztof Koziol
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
I'm not providing any interfaces in my design.
 
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In this case the SLSB implemented with @WebServiceRef annotation will still be in business tier, right?

Although it is also doing job of WS client, it will not be in integration tier, right?
 
Krzysztof Koziol
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

Gurukant Desai wrote:In this case the SLSB implemented with @WebServiceRef annotation will still be in business tier, right?

Although it is also doing job of WS client, it will not be in integration tier, right?



In my opinion it should be in the integration tier since it job is to send requests and receive responses from WS server. Except converting requests from XML to POJOs (done automatically by JAXB) there is no business logic executed by this SLSB.
 
reply
    Bookmark Topic Watch Topic
  • New Topic