• 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
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

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 wop bop a lu bob a womp bam boom. Tutti frutti ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic