7 Replies Latest reply: Apr 26, 2014 2:28 PM by Paul Robinson RSS

JaxWSTxInboundBridgeHandler (Allow calls without WS-AT session)

Ander Ruiz Newbie

I need to create an application that allows WS-AT calls for webservices so that the transaction can be handled from the application that is calling the WS. That is already working thanks to the JaxWSTxInboundBridgeHandler, the problem is that I would like to be able to call the WS also without WS-AT headers. In that situation the desired behaviour would be to consider each call a transaction,

 

Is it possible? which is the easiest way to acchieve that?

 

EDIT: Let me rephrase the question my real problem is that I'm suffering performance problems due to WS-AT. Begin and Commit methods are taking more time than the rest of the call

 

13:25:09,973 INFO  WSOperation:begin() started on transaction:Unknown

13:25:10,057 INFO WSOperation:begin() finished on transaction:AtomicTransactionIdentifier

13:25:10,536 INFO WSOperation:commit() started on transaction:AtomicTransactionIdentifier

13:25:11,037 INFO WSOperation:commit() finished on transaction:AtomicTransactionIdentifier

 

Are those values normal? I'm doing a "get" call that does not commit anything

  • 1. Re: JaxWSTxInboundBridgeHandler (Allow calls without WS-AT session)
    Paul Robinson Master

    Ander,

     

    Are you using Transaction annotations (Either from EJB or JTA 1.2)? If so, just specify the attribute of REQUIRED. See the JTA 1.2 spec for a description:

     

    • TxType.REQUIRED: If called outside a transaction context, the interceptor must begin a new JTA transaction, the managed bean method execution must then continue inside this transaction context, and the transaction must be com- pleted by the interceptor.

    If called inside a transaction context, the managed bean method execution must then continue inside this transaction context.

     

    Paul.

  • 2. Re: JaxWSTxInboundBridgeHandler (Allow calls without WS-AT session)
    Ander Ruiz Newbie

    This question is related to:

     

    XTS + JTA + MyBatis-Spring

     

    I'm not using EJBs in this project, persistency is handled by MyBatis which is called from Webservices. Can I add those annotations to WS also?. Appart from that if I remember correctly the error I was getting was on the handler rather that in the WS, would that be solved also by annotations?.

     

    For now my custom made solutions has been to create a WS Handler that starts the transaction if it is not created and latter commits or rolls back depending on the WS call.

  • 3. Re: JaxWSTxInboundBridgeHandler (Allow calls without WS-AT session)
    Gytis Trikleris Newbie

    Hello Ander,

     

    there was a restriction in XTS inbound bridge released with older versions of JBoss AS (you are using JBoss 7.2.0 right?). WS-AT transaction has to be available, if inbound bridge handler is registered.
    This problem was fixed in WildFly 8.0.0.Final once we introduced the optional inbound bridge handler.

    Also, in WIldFly 8.0.0.Final you would not need to registered XTS handlers, since it is done automatically.

    And finally, WildFly 8.0.0.Final has JTA 1.2 support. Thus, you would be able to use @Transactional annotation on your POJOs (as Paul mentioned in previous comment).

     

    Hope that helps.

    Gytis

  • 4. Re: JaxWSTxInboundBridgeHandler (Allow calls without WS-AT session)
    Ander Ruiz Newbie

    I edited my question with more information

  • 5. Re: JaxWSTxInboundBridgeHandler (Allow calls without WS-AT session)
    Paul Robinson Master

    Ander,

     

    So I think what you are saying is:

     

    1) You are experiencing high latency on calls with WS-AT enabled and you want to know if it's normal.

     

    Web services in general are pretty slow, compared to a binary and less verbose protocol. WS-AT makes several WS calls as part of the 2PC protocol, which is triggered when the client calls commit. Therefore, the 500ms commit, is in fact made up of several WS calls. With an un-tuned SOAP stack, I'd only expect you to see a few transactions per second. I don't have any recent figures to hand, but 10/sec would not surprise me. Most of the time is spent in the WS calls, so applying any general WS tuning techniques would help here.

     

    2) Due to the overhead of WS-AT, you only want it enable it for WS calls that need it.

     

    This is harder to do prior to WildFly 8.0.0.Final as the WS-AT handlers on the server-side are not optional. Therefore you would need to offer a separate service that doesn't have those handlers enabled. Otherwise, the services would be identical. It's easier on the client-side, just add the WS-AT client-side handlers programatically when needed: https://github.com/jbosstm/quickstart/blob/8aa786bb06b1eeb765b8c2df8341e611b687bb47/TXBridge/demo/client/src/main/java/org/jboss/jbossts/txbridge/demo/client/BasicClient.java#L243

     

    Paul.

  • 6. Re: JaxWSTxInboundBridgeHandler (Allow calls without WS-AT session)
    Ander Ruiz Newbie

    Thanks for your response, the problem I'm facing is the following, my transaction is in fact a JBPM file that calls several internal WS (inside the same JBoss), if everything is ok then all the operations should be commited and otherwise rolled back. Before using WS-AT I was able to execute the JBPM in 50ms (4 WS calls), being each call a transaction. Once I introduced WS-AT the performance was severely impacted. My implementation currently does the following

     

    - JBPM executor jobs control the transaction calling begin/commit/rollback from the job

    - Appart from that I registered a custom SOAPHandler that detects if an UserTransaction is associated with that call (using UserTransactionFactory.userTransaction()) and if not it creates it. For those automatically created transactions the same handler commits or rolls them back. This approach implies that lookup calls are also being called inside the context of a transaction without requiring it. The general purpose of this handler is to allow clients to call without WS-AT header that JaxWSTxInboundBridgeHandler requires

     

    The times I sent yesterday were not accurate, as I was profiling, the real times are:

     

    08:51:56,627 INFO  [com.telvent.tolling.services.WSATTransactionWSHandler] (http-/0.0.0.0:8080-29) WSOperation:begin() started on transaction:Unknown

    08:51:56,660 INFO  [com.telvent.tolling.services.WSATTransactionWSHandler] (http-/0.0.0.0:8080-29) WSOperation:begin() finished (33ms) on transaction:AtomicTransactionIdentifier: urn:0:ffff7f000001:-4ee0ff54:5354bf70:168e9

    08:51:41,960 INFO  [com.telvent.tolling.services.WSATTransactionWSHandler] (http-/0.0.0.0:8080-25) WSOperation:commit() started on transaction:AtomicTransactionIdentifier: urn:0:ffff7f000001:-4ee0ff54:5354bf70:1688f

    08:51:42,175 INFO  [com.telvent.tolling.services.WSATTransactionWSHandler] (http-/0.0.0.0:8080-25) WSOperation:commit() finished (215ms) on transaction:AtomicTransactionIdentifier: urn:0:ffff7f000001:-4ee0ff54:5354bf70:1688f

     

    Our performance goal is approximately the values we were having before WS-AT, about 20t/s but we with this commit time we can acchieve 3-4t/s which is insufficient.

     

    Answering to your questions:

     

    1) Which techniques could be applied to tune SOAP stack?, it is the first time we use WS in an environment when performance is important.

    2) I have several questions here:

    • Is there any way to backport WildFly changes to JBoss 7.2 with a custom SOAPHandler that subclasses JaxWSTxInboundBridgeHandler for example? or are there additional changes in XTS module that I would require?
    • The other option you comment is to create two different WS one with JaxWSTxInboundBridgeHandler and the other without it, here I have two doubts, the first is, is it possible to deploy two implementation on the WS inside the same WAR with different URLs? appart from that if there is no handler registered how will be the WS calls treated? will each call imply a JTA transaction automatically the commits or rolls back depending if an exception has been thrown? or do I need to add something appart from that?
    • Those first two question still does not solve the main problem that is the performance for the JBPM transactions but reading the example you sent I found interesting testJTATransaction method. Is it possible to handle directly JTA transaction that will be used? Can it be faster than using testAtomicTransaction approach?. All my system is going to be in the same JBoss instance.

     

    I know there are a lot of questions/doubts so thanks in advance ;-)

  • 7. Re: JaxWSTxInboundBridgeHandler (Allow calls without WS-AT session)
    Paul Robinson Master

    Ander,

     

    1) Which techniques could be applied to tune SOAP stack?, it is the first time we use WS in an environment when performance is important.

    I'm no expert on this, but I know you can do things like switch to a binary format using MTOM. I suggest you look at the JBossWS and CXF documentation for more insightful information. You could also ask on the JBossWS forum, as this is a general optimisation that applies to any WS setup. Remember whatever you do also needs to be applied to the WS-AT protocol messages as well as the business logic.

     

    Is there any way to backport WildFly changes to JBoss 7.2 with a custom SOAPHandler that subclasses JaxWSTxInboundBridgeHandler for example? or are there additional changes in XTS module that I would require?

    You should just be able to implement the OptionalJaxWSTxInboundBridgeHandler.java in your own code and use that in place of the JaxWSTxInboundBridgeHandler.java. See the Jira issue and the associated fix for more details on what we added to WildFly to do this:

     

    [JBTM-1963] Automatically added TXBridge handler should be optional - JBoss Issue Tracker

    JBTM-1963. Automatically added TXBridge handler should be optional ·  694483c · Gytis/narayana · GitHub

     

    The other option you comment is to create two different WS one with JaxWSTxInboundBridgeHandler and the other without it, here I have two doubts, the first is, is it possible to deploy two implementation on the WS inside the same WAR with different URLs? appart from that if there is no handler registered how will be the WS calls treated? will each call imply a JTA transaction automatically the commits or rolls back depending if an exception has been thrown? or do I need to add something appart from that?

    I wasn't suggesting anything clever or magic here. Simply implement two completely different web services (one with WS-AT handlers, the other without). Then delegate to the real business logic from those services, to save you having to have the code in two places. Yes it's a hack!

     

    Those first two question still does not solve the main problem that is the performance for the JBPM transactions but reading the example you sent I found interesting testJTATransaction method. Is it possible to handle directly JTA transaction that will be used? Can it be faster than using testAtomicTransaction approach?. All my system is going to be in the same JBoss instance.

     

     

    If everything is running in the same JBoss instance, why are you using web services? It would be much more efficient to just use JTA transactions and call your services directly, rather than over web services. Or maybe I've missed something?

     

    Paul.