• 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

Transaction Handling when accessing external systems

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

SuD is interacting with external system and external web services.
Is it good to use javax.transaction.UserTransaction for handling distributed transactions?

Thanks,
Sree
 
Ranch Hand
Posts: 218
Hibernate Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Web services cannot participcate in JTA transactions.
The external system needs to be accessible via JCA to participate in JTA transactions.
 
Srinivas Pittala
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Rishi,

Thanks for your response.
To consume external web services, generally we do not opt for JCA.Directly will invoke the link provided by web service providers
by writing a WS client(Session Bean--->WSPOJO--->External web services).

Is it the right way to handle a transactions in the following way by using container managed transaction attribute?
SuD invoke the session bean by using a controller

Appreciate your help.


@stateless
beanImplMethod(){
try{
invokeWebServiceMethod(){

//logic for invoking a web services...
}

}catch( Exception ex){
sessioncontext.setRollBackOnly()

}
}

Thanks,
Sree
 
Rishi Shehrawat
Ranch Hand
Posts: 218
Hibernate Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
To the best of my knowledge there is no out of the box support for transaction managment of web services using JTA. The snippet provided by you will not work.
However there are ways to make it work by using WS-AtomicTransaction, WS-Coordination, however it comes at a cost in terms of increased complexity, performance, etc.
Have a look at (http://metro.java.net/guide/Using_Web_Services_Atomic_Transactions.html)
Normally you try to avoid all this complexity by writing compensating logic which works in conjuction with reconcilling logic for reconcilling your app with the external system via day end job or some other mechanisim.
 
Srinivas Pittala
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Rishi,

Thank you very much for your repsponse..


Thanks,
Sree
 
A "dutch baby" is not a baby. But this tiny ad is baby sized:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic