This week's book giveaway is in the General Computing forum.
We're giving away four copies of Learning Regular Expressions and have Ben Forta on-line!
See this thread for details.
Win a copy of Learning Regular Expressions this week in the General Computing forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Knute Snortum
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Ganesh Patekar
  • Stephan van Hulst
  • Pete Letkeman
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Ron McLeod
  • Vijitha Kumara

Transaction Handling when accessing external systems  RSS feed

 
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • 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 Java Spring
  • Mark post as helpful
  • send pies
  • 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
  • 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 Java Spring
  • Mark post as helpful
  • send pies
  • 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
  • Quote
  • Report post to moderator
Rishi,

Thank you very much for your repsponse..


Thanks,
Sree
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!