• Post Reply Bookmark Topic Watch Topic
  • New Topic

Can URLConnection or socket sbe used from within a Session Bean?  RSS feed

 
tauqeer bhatti
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can we use URLConnection object from within Session bean to access some say servlet to send an XML string in request and resceive XML reply. I have told that using Sockets and URL Connection are not recommneded by EJB specifications to be used from with in EJBs.
 
Lasse Koskela
author
Sheriff
Posts: 11962
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Exactly. It's not recommended but is definitely possible.
 
tauqeer bhatti
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks ! for your response. Please let me share the following two design choices with you.
One solution as I suggested earlier is using a Session Bean which will use a URLConnection Object to execute certain scritps and receive response form WebServer (this WebServer will be executing those scripts). Session bean may parse the response from the server to draw some meaningfull information.
The other options may be that my session bean just post a Synchornous message (this message may have an XML body containg info. about the percl scritp to be executed)using JMS. Then we can have multiple instances of JMS client appliations which will consume that message and execute requested script. After executing that script they may create an xml message containg the results of the execution. This message reply will be retrurned to my session bean. Session bean now can use results of perl script execution in my J2EE application.
However, I am a little hesitant to use second approach since once perl application is migrated to a java application spending on JM provider will be wasted. However, I'd like to have a session bean facade, since the implementation behind this facade may change with out affecting client programming model.
Looking forward to your input.
Thanks!
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!