title: IBM MQ does not roll back in WS-AT transaction
body: <p>I have a similar problem to the case described in <a href="https://stackoverflow.com/questions/32648007/mq-queue-transaction-not-rolled-back-in-a-2-phase-transaction">MQ Queue transaction not rolled back in a 2 phase transaction</a>. I have a .NET client which does the following in one transaction:</p>
  <ol>
  <li>Writes one record to the first database.</li>
  <li>Puts one message into an IBM Websphere 8.0 MQ Series queue.</li>
  <li>Calls with WS-AT the web service as described in <a href="https://developers.redhat.com/quickstarts/eap/wsat-simple" rel="nofollow noreferrer">https://developers.redhat.com/quickstarts/eap/wsat-simple</a>.</li>
  <li>Writes one record to the second database.</li>
  </ol>
  <p>When the web service rolls back, the two databases roll back but not the IBM MQ Series queue.
  When one database fails, then the IBM MQ Series queue does roll back.</p>
  <p>The method RestaurantTransactionPOC runs in a class that inherits from System.EnterpriseServices.ServicedComponent, that means, it runs under COM+.</p>
  <p>Here is the code of RestaurantTransactionPOC:</p>
  <pre><code>Public Function RestaurantTransactionPOC(
      uri As String, queueManager As String, queueName As String, textToWrite As String,
      Optional failOnlRecvRep As Boolean = False,
      Optional failGtsRecvRep As Boolean = False,
      Optional failWSATService As Boolean = False,
      Optional failMQSeries As Boolean = False) As String
      Try
          Dim result = &quot;&quot;
          Dim msgId = GetMsgId()
          Try
              AddOnlRecvRep(msgId, failOnlRecvRep)
          Catch ex As Exception
              Debug.WriteLine(ex.ToString)
              result &amp;= ex.ToString &amp; vbCrLf
          End Try
          Try
              AddQueue(queueManager, queueName, msgId, failMQSeries)
          Catch ex As Exception
              Debug.WriteLine(ex.ToString)
              result &amp;= ex.ToString &amp; vbCrLf
          End Try
          Try
              ServicePointManager.SecurityProtocol = CType(SecurityProtocolType.Tls Or 768 Or 3072, SecurityProtocolType)
              Dim client = CreateChannel(Of RestaurantServiceATChannel)(uri)
              client.makeBooking()
          Catch ex As Exception
              Debug.WriteLine(ex.ToString)
              result &amp;= ex.ToString &amp; vbCrLf
          End Try
          Try
              AddGtsRecvRep(msgId, failGtsRecvRep)
          Catch ex As Exception
              Debug.WriteLine(ex.ToString)
              result &amp;= ex.ToString
          End Try
          ContextUtil.SetComplete()
          Return result
      Catch ex As Exception
          ContextUtil.SetAbort()
          Throw
      End Try
  End Function
  
  Public Function CreateChannel(Of T)(uri As String) As T
              binding = New CustomBinding(
                  New BindingElement() {
                      New TransactionFlowBindingElement(TransactionProtocol.WSAtomicTransaction11),
                      New TextMessageEncodingBindingElement() With {.MessageVersion = MessageVersion.Soap12},
                      New HttpsTransportBindingElement()})
      binding.SendTimeout = New TimeSpan(0, 0, 30)
      Dim endpoint As New EndpointAddress(uri)
      Dim channelFactory = New ChannelFactory(Of T)(binding, endpoint)
                  Dim behavior = CType(channelFactory.Endpoint.Behaviors(1), ClientCredentials)
                  behavior.ClientCertificate.SetCertificate(
                      StoreLocation.LocalMachine, StoreName.My, X509FindType.FindByThumbprint,
                      &quot;5f 82 82 e3 e9 20 fd ac 27 f5 cc 60 8a f5 8e 55 39 38 a0 30&quot;)
      Return channelFactory.CreateChannel()
  End Function
  </code></pre>
  <p>Why does the IBM MQ Series queue not roll back, when the WS-AT makeBooking service rolls back?</p>