wsit
  1. wsit
  2. WSIT-1562

Transaction is not created explicitly for web operations marked as 'requires transaction'

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Works as designed
    • Affects Version/s: 2.1
    • Fix Version/s: None
    • Component/s: transaction
    • Labels:
      None
    • Environment:

      Glassfish 3.1
      Windows 7
      NetBeans 6.9.1

      Description

      Metro used to explicitly create a transaction for web operations marked as 'requires transaction' in the WSDL. eg.

      <wsp:Policy xmlns:wsat200410="http://schemas.xmlsoap.org/ws/2004/10/wsat" wsu:Id="MyWebServicePortBinding_sayHello_Policy">
      <wsat200410:ATAlwaysCapability />
      <wsat200410:ATAssertion wsp:Optional="true"/>
      </wsp:Policy>

      <operation name="sayHello">
      <wsp:PolicyReference URI="#MyWebServicePortBinding_sayHello_Policy" />
      <soap:operation soapAction="" />
      <input>
      <soap:body use="literal" />
      </input>
      <output>
      <soap:body use="literal" />
      </output>
      </operation>

      I noticed the change of behaviour when I migrated from Glassfish 3.1 beta 12 to Glassfish 3.1 beta 32. I have also tested against Glassfish 3.1 final and Glassfish 3.1.1 beta 6 and the problem is still there.

      In the attached example, the server provides a single service 'sayHello' which is annotated in the WSDL as 'requires transaction'. The server also contains two Stateless beans with methods also marked as 'requires transaction'.

      As you can see in the log bellow, sayHello

      • prints the transaction key
      • calls SessionBean1, which prints the transaction key
      • calls SessionBean2, which prints the transaction key
      • prints the transaction key

      You will notice that the transaction key is non-existent within sayHello and that each session bean has to explicitly create their own transaction, which does not seem correct.

      Log
      -------------------
      INFO: the effective transaction attribute for operation' sayHello' is : enabled(true),required(false), version(WSAT10).
      INFO: processRequest HeaderList:[] TransactionalAttribute:com.sun.xml.ws.tx.at.tube.TransactionalAttribute@5a6d70 isEnabled:true
      INFO: sayHello A -->>> transaction key: null
      INFO: EJB1 -->>> transaction key: JavaEETransactionImpl: txId=35 nonXAResource=null jtsTx=null localTxStatus=0 syncs=[com.sun.ejb.containers.ContainerSynchronization@1f66bc0]
      INFO: EJB2 -->>> transaction key: JavaEETransactionImpl: txId=36 nonXAResource=null jtsTx=null localTxStatus=0 syncs=[com.sun.ejb.containers.ContainerSynchronization@922394]
      INFO: sayHello B -->>> transaction key: null
      -------------------

        Activity

        Show
        armanis added a comment - - edited I have also tried annotating the web methods following the instructions in the metro guide but it still does not create the transaction http://metro.java.net/guide/Using_Web_Services_Atomic_Transactions.html#Example__Using__Transactional_Annotation_on_a_Web_Service_Method http://metro.java.net/guide/Using_Web_Services_Atomic_Transactions.html#Example__Using_the__Transactional_and_the_EJB__TransactionAttribute_Annotations_Together
        Hide
        armanis added a comment -

        Here is the log from Glassfish 3.1 beta 12

        Log
        -------------------
        INFO: sayHello A -->>> transaction key: JavaEETransactionImpl: txId=2 nonXAResource=null jtsTx=null localTxStatus=0 syncs=[]
        INFO: EJB1 -->>> transaction key: JavaEETransactionImpl: txId=2 nonXAResource=null jtsTx=null localTxStatus=0 syncs=[]
        INFO: EJB2 -->>> transaction key: JavaEETransactionImpl: txId=2 nonXAResource=null jtsTx=null localTxStatus=0 syncs=[]
        INFO: sayHello B -->>> transaction key: JavaEETransactionImpl: txId=2 nonXAResource=null jtsTx=null localTxStatus=0 syncs=[]
        -------------------

        Show
        armanis added a comment - Here is the log from Glassfish 3.1 beta 12 Log ------------------- INFO: sayHello A -->>> transaction key: JavaEETransactionImpl: txId=2 nonXAResource=null jtsTx=null localTxStatus=0 syncs=[] INFO: EJB1 -->>> transaction key: JavaEETransactionImpl: txId=2 nonXAResource=null jtsTx=null localTxStatus=0 syncs=[] INFO: EJB2 -->>> transaction key: JavaEETransactionImpl: txId=2 nonXAResource=null jtsTx=null localTxStatus=0 syncs=[] INFO: sayHello B -->>> transaction key: JavaEETransactionImpl: txId=2 nonXAResource=null jtsTx=null localTxStatus=0 syncs=[] -------------------
        Hide
        armanis added a comment -

        Problem persists after retesting against Glassfish 3.1.1 final, as expected I guess

        Show
        armanis added a comment - Problem persists after retesting against Glassfish 3.1.1 final, as expected I guess
        Hide
        arjavdesai added a comment -

        Following "required(false)" in the log line

        -------------------
        INFO: the effective transaction attribute for operation' sayHello' is : enabled(true),required(false), version(WSAT10).

        means that it SUPPORTS transaction if provided and not thats it would create one. Actually, a POJO WS will never create its own transaction i.e. if its set to MANDATORY and client doesn't pass transaction, it will fail rather than creating one.

        Since your client is not invoking WS in a transaction, it's just invoked without WSAT.

        While, we are on the topic, I should mention that, we don't support bottom-up (wsdl-to-java) for WS-AT so having manual advertisement in WSDL while corresponding Endpoint class not having Transactional annotation would results in unsupported scenario.

        Show
        arjavdesai added a comment - Following "required(false)" in the log line ------------------- INFO: the effective transaction attribute for operation' sayHello' is : enabled(true),required(false), version(WSAT10). means that it SUPPORTS transaction if provided and not thats it would create one. Actually, a POJO WS will never create its own transaction i.e. if its set to MANDATORY and client doesn't pass transaction, it will fail rather than creating one. Since your client is not invoking WS in a transaction, it's just invoked without WSAT. While, we are on the topic, I should mention that, we don't support bottom-up (wsdl-to-java) for WS-AT so having manual advertisement in WSDL while corresponding Endpoint class not having Transactional annotation would results in unsupported scenario.

          People

          • Assignee:
            arjavdesai
            Reporter:
            armanis
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: