You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Edumudi Viswanath <ed...@oracle.com> on 2010/12/08 10:53:46 UTC

Calling 2 web services from a master webservice

Hi,

 

Our requirement is as follow.

 

Assume, Webservice_one needs to insert data into  "table1" of oracle db & webservice_two needs to insert data into "table2" of oracle db.

Now, we need to call webservice_one & webservice_two from another webservice "webservice_master". 

 

The webservices called inside "webservice_master" are should be in one transaction. Ie based on result of insertion of table2 of webservice_two, "webservice_master" may commit or rollback the insertion done by werservice_one.

 

Basic Questions 4m our end:

1)      Do we require any third party Transaction Managers (like jboss TM, arjuna Transaction manager, atomikos  ) for this kind of scenarios?

2)      What is the best way to crack this kind of scenario(s)?

 

Kindly help us.

 

Thanks & Regards,

vishy

Re: Calling 2 web services from a master webservice

Posted by Andrew Dinn <an...@googlemail.com>.
On 12/08/2010 09:53 AM, Edumudi Viswanath wrote:
> Our requirement is as follow.
> . . .
>
> Basic Questions 4m our end:
>
> 1)      Do we require any third party Transaction Managers (like
> jboss TM, arjuna Transaction manager, atomikos  ) for this kind of
> scenarios?

You require some sort of transaction mechanism if you want this to be 
guaranteed to be consistent. Of course, you can implement your own code 
to track and, if necessary, roll back progress of the updates. In part 
whether it is easier for you to do that or use a 3rd party depends on 
how much of a guarantee of consistency you want. If you want to be sure 
that a failure causes both services to rollback even if one or more of 
the three services crashes (and this might include crashing again during 
recovery) then you should look at using a 3rd party manager. Writing 
code to handle this sort of scenario yourself is very hard to do.

I don't make that recommendation lightly. I am  the lead  programmer for 
the JBoss Web Services Transactions Product (JBoss XTS). I know how hard 
it has been to get our software to support the WSTX protocols absolutely 
correctly with all corner cases eliminated.

> 2)      What is the best way to crack this kind of scenario(s)?

If you want to do it your self then before you start look at some good 
books on transactions, read the JTA specs, read the WSTX specs. After 
that either implement these protocols directly or come up with a 
simplified design which answers your needs. The principles are 
relatively straightforward. It's the details of implementation which 
contains all the gotchas. You could look at the JBossTS and JBoss XTS 
source code if you want inspiration.

If  you want to use a 3rd party product then you could try using the 
WS-AT Web Services Transactions implementation provided by JBoss 
combined with the WS-AT <--> JTA bridging code which is currently 
available as a community only release (but will be supported very soon). 
You need to use the bridging code on either end. On the master you can 
start a JTA transaction and use the JTA --> WS-AT bridge to translate to 
a WS-AT transaction so that the web service calls operate in a WS-AT 
transaction under the control of the JTA transaction. You need the WS-AT 
--> JTA bridging code on web services 1 and 2. This translates from a 
WS-AT transaction to a JTA transaction, allowing the database operations 
performed by the web services to be tied to progress of the WS-AT 
transaction and, from  there, to the original JTA transaction on the master.

regards,


Andrew Dinn
-----------

RE: Calling 2 web services from a master webservice

Posted by Edumudi Viswanath <ed...@oracle.com>.
Thanks for ur kind help.

We will try to interact with him regarding this.
 
Regards
vishy


-----Original Message-----
From: Andrew Dinn [mailto:adinn@redhat.com] 
Sent: Wednesday, December 08, 2010 7:54 PM
To: users@cxf.apache.org
Cc: Edumudi Viswanath
Subject: Re: Calling 2 web services from a master webservice

Hi Edmundi,

On 12/08/2010 01:38 PM, Edumudi Viswanath wrote:
> When I looked @ http://www.jboss.org/jbosstm, it is clear that it is
> premier open source. What it mean??

Hmm, I don't work in marketing so . . . your guess is as good as mine :-)

What I can confirm is that both JBossTS and XTS are open source code 
released under the LGPL.

> "Although JBossTS is shipped as part of JBoss Application Server, it
> continues to be developed as a stand-alone transaction manager. It
> can be embedded in a range of containers, but JBossTS provides
> everything you need to develop transactional applications."

JBossTS can be used embedded in an application without the need  to 
execute inside an application server. In particular, it is not necessary 
to run it inside JBoss AS. Configuration of JBossTS for standalone use 
is described in the JBossTS documentation.

The XTS code is a slightly less sttraightforward. The transaction 
management capabilities of XTS conform to the Oasis WSTX standard and so 
they require the use of a Web Services stack. XTS has been built to rely 
on the availability of JBossWS using either the CXF or Native soap stack 
implementation. Since JBossWS only runs inside JBoss AS the same 
restriction normally applies if you want to use XTS -- your app must be 
deployed inside JBoss AS.

However, while preparing the latest release of JBossTS/XTS (4.13.0) I 
spent a lot of time working with one of our community users (Mauro 
Molinari) to make it simple to unbundle the normal XTS release and 
rebundle it so that it can run embedded alongside JBossTS outside of 
JBoss AS. Obviously it still needs to employ the services of a 
standalone WS stack so you need to deploy this with your app as well 
(luckily for you Mauro wanted to use CXF so the changes I made have been 
tested on this deployment).

The 4.13.0 release can now be configured relatively easily for 
deployment with JBossTS and CXF outside of JBoss AS. This process is not 
fully documented (it will be over the next few releases) but you can 
find the details of what to do to run standalone in the forum discussion 
which led up to the 4.13 release.

   http://community.jboss.org/thread/154364?tstart=0

It's a very long thread but all the info you need is in there.

Essentially, to configure XTS for standalone operation you need to 
unbundle the release archive and deploy all the jars separately, rewire 
the server endpoints embedded in the web.xml files so that they are 
deployed by CXF, rewire the jboss-beans.xml file which is used to inject 
configuration settings into the XTS code, deploy one extra utility jar 
taken from the relevant JBossWS release and then initialise XTS when 
your app starts up and shut it down when your app exits.

> Can we use this as a 3rd party Transaction Manager inside any
> application with free of cost??

Yes, you can use this free of cost.

Re: Calling 2 web services from a master webservice

Posted by Andrew Dinn <ad...@redhat.com>.
Hi Edmundi,

On 12/08/2010 01:38 PM, Edumudi Viswanath wrote:
> When I looked @ http://www.jboss.org/jbosstm, it is clear that it is
> premier open source. What it mean??

Hmm, I don't work in marketing so . . . your guess is as good as mine :-)

What I can confirm is that both JBossTS and XTS are open source code 
released under the LGPL.

> "Although JBossTS is shipped as part of JBoss Application Server, it
> continues to be developed as a stand-alone transaction manager. It
> can be embedded in a range of containers, but JBossTS provides
> everything you need to develop transactional applications."

JBossTS can be used embedded in an application without the need  to 
execute inside an application server. In particular, it is not necessary 
to run it inside JBoss AS. Configuration of JBossTS for standalone use 
is described in the JBossTS documentation.

The XTS code is a slightly less sttraightforward. The transaction 
management capabilities of XTS conform to the Oasis WSTX standard and so 
they require the use of a Web Services stack. XTS has been built to rely 
on the availability of JBossWS using either the CXF or Native soap stack 
implementation. Since JBossWS only runs inside JBoss AS the same 
restriction normally applies if you want to use XTS -- your app must be 
deployed inside JBoss AS.

However, while preparing the latest release of JBossTS/XTS (4.13.0) I 
spent a lot of time working with one of our community users (Mauro 
Molinari) to make it simple to unbundle the normal XTS release and 
rebundle it so that it can run embedded alongside JBossTS outside of 
JBoss AS. Obviously it still needs to employ the services of a 
standalone WS stack so you need to deploy this with your app as well 
(luckily for you Mauro wanted to use CXF so the changes I made have been 
tested on this deployment).

The 4.13.0 release can now be configured relatively easily for 
deployment with JBossTS and CXF outside of JBoss AS. This process is not 
fully documented (it will be over the next few releases) but you can 
find the details of what to do to run standalone in the forum discussion 
which led up to the 4.13 release.

   http://community.jboss.org/thread/154364?tstart=0

It's a very long thread but all the info you need is in there.

Essentially, to configure XTS for standalone operation you need to 
unbundle the release archive and deploy all the jars separately, rewire 
the server endpoints embedded in the web.xml files so that they are 
deployed by CXF, rewire the jboss-beans.xml file which is used to inject 
configuration settings into the XTS code, deploy one extra utility jar 
taken from the relevant JBossWS release and then initialise XTS when 
your app starts up and shut it down when your app exits.

> Can we use this as a 3rd party Transaction Manager inside any
> application with free of cost??

Yes, you can use this free of cost.

RE: Calling 2 web services from a master webservice

Posted by Edumudi Viswanath <ed...@oracle.com>.
Hi,

Thanks 4 your reply.

When I looked @ http://www.jboss.org/jbosstm, it is clear that it is premier open source. What it mean??

"Although JBossTS is shipped as part of JBoss Application Server, it continues to be developed as a stand-alone transaction manager. It can be embedded in a range of containers, but JBossTS provides everything you need to develop transactional applications."

Can we use this as a 3rd party Transaction Manager inside any application with free of cost??

Thanks & Regards
Vishy


-----Original Message-----
From: Andrew Dinn [mailto:adinn@redhat.com] 
Sent: Wednesday, December 08, 2010 6:05 PM
To: users@cxf.apache.org
Subject: Re: Calling 2 web services from a master webservice

On 12/08/2010 09:53 AM, Edumudi Viswanath wrote:
 > Our requirement is as follow.
 > . . .
 >
 > Basic Questions 4m our end:
 >
 > 1)      Do we require any third party Transaction Managers (like
 > jboss TM, arjuna Transaction manager, atomikos  ) for this kind of
 > scenarios?

You require some sort of transaction mechanism if you want this to be 
guaranteed to be consistent. Of course, you can implement your own code 
to track and, if necessary, roll back progress of the updates. In part 
whether it is easier for you to do that or use a 3rd party depends on 
how much of a guarantee of consistency you want. If you want to be sure 
that a failure causes both services to rollback even if one or more of 
the three services crashes (and this might include crashing again during 
recovery) then you should look at using a 3rd party manager. Writing 
code to handle this sort of scenario yourself is very hard to do.

I don't make that recommendation lightly. I am  the lead  programmer for 
the JBoss Web Services Transactions Product (JBoss XTS). I know how hard 
it has been to get our software to support the WSTX protocols absolutely 
correctly with all corner cases eliminated.

 > 2)      What is the best way to crack this kind of scenario(s)?

If you want to do it your self then before you start look at some good 
books on transactions, read the JTA specs, read the WSTX specs. After 
that either implement these protocols directly or come up with a 
simplified design which answers your needs. The principles are 
relatively straightforward. It's the details of implementation which 
contains all the gotchas. You could look at the JBossTS and JBoss XTS 
source code if you want inspiration.

If  you want to use a 3rd party product then you could try using the 
WS-AT Web Services Transactions implementation provided by JBoss 
combined with the WS-AT <--> JTA bridging code which is currently 
available as a community only release (but will be supported very soon). 
You need to use the bridging code on either end. On the master you can 
start a JTA transaction and use the JTA --> WS-AT bridge to translate to 
a WS-AT transaction so that the web service calls operate in a WS-AT 
transaction under the control of the JTA transaction. You need the WS-AT 
--> JTA bridging code on web services 1 and 2. This translates from a 
WS-AT transaction to a JTA transaction, allowing the database operations 
performed by the web services to be tied to progress of the WS-AT 
transaction and, from  there, to the original JTA transaction on the master.

regards,


Andrew Dinn
-----------

Re: Calling 2 web services from a master webservice

Posted by Andrew Dinn <ad...@redhat.com>.
On 12/08/2010 09:53 AM, Edumudi Viswanath wrote:
 > Our requirement is as follow.
 > . . .
 >
 > Basic Questions 4m our end:
 >
 > 1)      Do we require any third party Transaction Managers (like
 > jboss TM, arjuna Transaction manager, atomikos  ) for this kind of
 > scenarios?

You require some sort of transaction mechanism if you want this to be 
guaranteed to be consistent. Of course, you can implement your own code 
to track and, if necessary, roll back progress of the updates. In part 
whether it is easier for you to do that or use a 3rd party depends on 
how much of a guarantee of consistency you want. If you want to be sure 
that a failure causes both services to rollback even if one or more of 
the three services crashes (and this might include crashing again during 
recovery) then you should look at using a 3rd party manager. Writing 
code to handle this sort of scenario yourself is very hard to do.

I don't make that recommendation lightly. I am  the lead  programmer for 
the JBoss Web Services Transactions Product (JBoss XTS). I know how hard 
it has been to get our software to support the WSTX protocols absolutely 
correctly with all corner cases eliminated.

 > 2)      What is the best way to crack this kind of scenario(s)?

If you want to do it your self then before you start look at some good 
books on transactions, read the JTA specs, read the WSTX specs. After 
that either implement these protocols directly or come up with a 
simplified design which answers your needs. The principles are 
relatively straightforward. It's the details of implementation which 
contains all the gotchas. You could look at the JBossTS and JBoss XTS 
source code if you want inspiration.

If  you want to use a 3rd party product then you could try using the 
WS-AT Web Services Transactions implementation provided by JBoss 
combined with the WS-AT <--> JTA bridging code which is currently 
available as a community only release (but will be supported very soon). 
You need to use the bridging code on either end. On the master you can 
start a JTA transaction and use the JTA --> WS-AT bridge to translate to 
a WS-AT transaction so that the web service calls operate in a WS-AT 
transaction under the control of the JTA transaction. You need the WS-AT 
--> JTA bridging code on web services 1 and 2. This translates from a 
WS-AT transaction to a JTA transaction, allowing the database operations 
performed by the web services to be tied to progress of the WS-AT 
transaction and, from  there, to the original JTA transaction on the master.

regards,


Andrew Dinn
-----------