{
if (soapMessage != null)
{
try
{
final TransactionManager transactionManager = TransactionManagerFactory.transactionManager() ;
final BusinessActivityManager businessActivityManager = BusinessActivityManagerFactory.businessActivityManager() ;
if (transactionManager != null)
{
final com.arjuna.mwlabs.wst.at.context.TxContextImple txContext =
(com.arjuna.mwlabs.wst.at.context.TxContextImple)transactionManager.suspend() ;
if (txContext != null)
{
messageContext.setProperty(AtomicTransactionConstants.WSAT_PROTOCOL, txContext) ;
}
}
if (businessActivityManager != null)
{
final com.arjuna.mwlabs.wst.ba.context.TxContextImple txContext =
(com.arjuna.mwlabs.wst.ba.context.TxContextImple)businessActivityManager.suspend() ;
if (txContext != null)
{
messageContext.setProperty(BusinessActivityConstants.WSBA_PROTOCOL_ATOMIC_OUTCOME, txContext) ;
}
}
final Element soapHeaderElement = soapMessage.getHeaderElement(CoordinationConstants.WSCOOR_NAMESPACE, CoordinationConstants.WSCOOR_ELEMENT_COORDINATION_CONTEXT) ;
if (soapHeaderElement != null)
{
final CoordinationContextType cc = CoordinationContextHelper.deserialise(soapHeaderElement) ;
final String coordinationType = cc.getCoordinationType().getValue() ;
if (AtomicTransactionConstants.WSAT_PROTOCOL.equals(coordinationType))
{
final TxContext txContext = new com.arjuna.mwlabs.wst.at.context.TxContextImple(cc) ;
transactionManager.resume(txContext) ;
}
else if (BusinessActivityConstants.WSBA_PROTOCOL_ATOMIC_OUTCOME.equals(coordinationType))
{
final TxContext txContext = new com.arjuna.mwlabs.wst.ba.context.TxContextImple(cc);
businessActivityManager.resume(txContext) ;