Search in sources :

Example 16 with SoapFault

use of com.arjuna.webservices.SoapFault in project narayana by jbosstm.

the class CoordinatorCompletionCoordinatorClient method sendSoapFault.

/**
 * send a soap fault
 * @param soapFault the fault to be sent
 * @param endpoint the endpoint to send the fault to
 * @param map addressing context to be used to send the fault
 * @param faultAction the action to associate with the message
 */
public void sendSoapFault(SoapFault11 soapFault, W3CEndpointReference endpoint, MAP map, String faultAction) throws SoapFault, IOException {
    AddressingHelper.installNoneReplyTo(map);
    map.setAction(faultAction);
    BusinessAgreementWithCoordinatorCompletionCoordinatorPortType port;
    port = getPort(endpoint, map, faultAction);
    Fault fault = ((SoapFault11) soapFault).toFault();
    port.soapFault(fault);
}
Also used : BusinessAgreementWithCoordinatorCompletionCoordinatorPortType(org.oasis_open.docs.ws_tx.wsba._2006._06.BusinessAgreementWithCoordinatorCompletionCoordinatorPortType) SoapFault(com.arjuna.webservices.SoapFault) Fault(org.xmlsoap.schemas.soap.envelope.Fault) SoapFault11(com.arjuna.webservices11.SoapFault11)

Example 17 with SoapFault

use of com.arjuna.webservices.SoapFault in project narayana by jbosstm.

the class CoordinatorEngine method sendUnknownTransaction.

/**
 * Send the UnknownTransaction message.
 */
private void sendUnknownTransaction(final MAP map, final ArjunaContext arjunaContext) {
    try {
        final MAP faultMAP = AddressingHelper.createFaultContext(map, MessageId.getMessageId());
        final InstanceIdentifier instanceIdentifier = arjunaContext.getInstanceIdentifier();
        final String message = WSTLogger.i18NLogger.get_wst11_messaging_engines_CoordinatorEngine_sendUnknownTransaction_1();
        final SoapFault soapFault = new SoapFault11(SoapFaultType.FAULT_SENDER, AtomicTransactionConstants.WSAT_ERROR_CODE_UNKNOWN_TRANSACTION_QNAME, message);
        ParticipantClient.getClient().sendSoapFault(faultMAP, soapFault, instanceIdentifier);
    } catch (final Throwable th) {
        WSTLogger.i18NLogger.warn_wst11_messaging_engines_CoordinatorEngine_sendUnknownTransaction_2(id, th);
    }
}
Also used : SoapFault(com.arjuna.webservices.SoapFault) InstanceIdentifier(com.arjuna.webservices11.wsarj.InstanceIdentifier) SoapFault11(com.arjuna.webservices11.SoapFault11) MAP(org.jboss.ws.api.addressing.MAP)

Example 18 with SoapFault

use of com.arjuna.webservices.SoapFault in project narayana by jbosstm.

the class BusinessActivityTerminatorStub method close.

public void close() throws TransactionRolledBackException, UnknownTransactionException, SystemException {
    final MAP map = AddressingHelper.createNotificationContext(MessageId.getMessageId());
    final RequestCallback callback = new RequestCallback();
    final TerminationParticipantProcessor terminationParticipantProcessor = TerminationParticipantProcessor.getProcessor();
    terminationParticipantProcessor.registerCallback(_id, callback);
    try {
        TerminationCoordinatorClient.getClient().sendClose(_terminationCoordinator, map, new InstanceIdentifier(_id));
        callback.waitUntilTriggered();
    } catch (final Throwable th) {
        throw new SystemException();
    } finally {
        terminationParticipantProcessor.removeCallback(_id);
    }
    if (callback.hasTriggered()) {
        if (callback.receivedClosed()) {
            return;
        }
        final SoapFault soapFault = callback.getSoapFault();
        if (soapFault != null) {
            final QName subcode = soapFault.getSubcode();
            if (ArjunaTXConstants.TRANSACTIONROLLEDBACK_ERROR_CODE_QNAME.equals(subcode)) {
                throw new TransactionRolledBackException();
            } else if (ArjunaTXConstants.UNKNOWNTRANSACTION_ERROR_CODE_QNAME.equals(subcode)) {
                throw new UnknownTransactionException();
            }
        }
    }
    throw new SystemException();
}
Also used : SoapFault(com.arjuna.webservices.SoapFault) SystemException(com.arjuna.wst.SystemException) UnknownTransactionException(com.arjuna.wst.UnknownTransactionException) QName(javax.xml.namespace.QName) InstanceIdentifier(com.arjuna.webservices11.wsarj.InstanceIdentifier) TransactionRolledBackException(com.arjuna.wst.TransactionRolledBackException) MAP(org.jboss.ws.api.addressing.MAP) TerminationParticipantProcessor(com.arjuna.webservices11.wsarjtx.processors.TerminationParticipantProcessor)

Example 19 with SoapFault

use of com.arjuna.webservices.SoapFault in project narayana by jbosstm.

the class CompletionStub method commit.

public void commit() throws TransactionRolledBackException, UnknownTransactionException, SystemException {
    final MAP map = AddressingHelper.createNotificationContext(MessageId.getMessageId());
    final CompletionStub.RequestCallback callback = new CompletionStub.RequestCallback();
    final CompletionInitiatorProcessor completionInitiator = CompletionInitiatorProcessor.getProcessor();
    completionInitiator.registerCallback(_id, callback);
    try {
        CompletionCoordinatorClient.getClient().sendCommit(_completionCoordinator, map, new InstanceIdentifier(_id));
        callback.waitUntilTriggered();
    } catch (final Throwable th) {
        th.printStackTrace();
        throw new SystemException();
    } finally {
        completionInitiator.removeCallback(_id);
    }
    if (callback.hasTriggered()) {
        if (callback.receivedCommitted()) {
            return;
        } else if (callback.receivedAborted()) {
            throw new TransactionRolledBackException();
        }
        final SoapFault soapFault = callback.getSoapFault();
        if ((soapFault != null) && ArjunaTXConstants.UNKNOWNTRANSACTION_ERROR_CODE_QNAME.equals(soapFault.getSubcode())) {
            throw new UnknownTransactionException();
        }
    }
    throw new SystemException();
}
Also used : SoapFault(com.arjuna.webservices.SoapFault) SystemException(com.arjuna.wst.SystemException) UnknownTransactionException(com.arjuna.wst.UnknownTransactionException) CompletionInitiatorProcessor(com.arjuna.webservices11.wsat.processors.CompletionInitiatorProcessor) InstanceIdentifier(com.arjuna.webservices11.wsarj.InstanceIdentifier) TransactionRolledBackException(com.arjuna.wst.TransactionRolledBackException) MAP(org.jboss.ws.api.addressing.MAP)

Example 20 with SoapFault

use of com.arjuna.webservices.SoapFault in project narayana by jbosstm.

the class CompletionStub method rollback.

public void rollback() throws UnknownTransactionException, SystemException {
    final MAP map = AddressingHelper.createNotificationContext(MessageId.getMessageId());
    final CompletionStub.RequestCallback callback = new CompletionStub.RequestCallback();
    final CompletionInitiatorProcessor completionInitiator = CompletionInitiatorProcessor.getProcessor();
    completionInitiator.registerCallback(_id, callback);
    try {
        CompletionCoordinatorClient.getClient().sendRollback(_completionCoordinator, map, new InstanceIdentifier(_id));
        callback.waitUntilTriggered();
    } catch (final Throwable th) {
        th.printStackTrace();
        throw new SystemException();
    } finally {
        completionInitiator.removeCallback(_id);
    }
    if (callback.hasTriggered()) {
        if (callback.receivedAborted()) {
            return;
        }
        final SoapFault soapFault = callback.getSoapFault();
        if ((soapFault != null) && ArjunaTXConstants.UNKNOWNTRANSACTION_ERROR_CODE_QNAME.equals(soapFault.getSubcode())) {
            throw new UnknownTransactionException();
        }
    }
    throw new SystemException();
}
Also used : SoapFault(com.arjuna.webservices.SoapFault) SystemException(com.arjuna.wst.SystemException) UnknownTransactionException(com.arjuna.wst.UnknownTransactionException) CompletionInitiatorProcessor(com.arjuna.webservices11.wsat.processors.CompletionInitiatorProcessor) InstanceIdentifier(com.arjuna.webservices11.wsarj.InstanceIdentifier) MAP(org.jboss.ws.api.addressing.MAP)

Aggregations

SoapFault (com.arjuna.webservices.SoapFault)40 MAP (org.jboss.ws.api.addressing.MAP)24 SoapFault11 (com.arjuna.webservices11.SoapFault11)19 SystemException (com.arjuna.wst.SystemException)15 UnknownTransactionException (com.arjuna.wst.UnknownTransactionException)15 InstanceIdentifier (com.arjuna.webservices11.wsarj.InstanceIdentifier)14 ArjunaContext (com.arjuna.webservices11.wsarj.ArjunaContext)10 Fault (org.xmlsoap.schemas.soap.envelope.Fault)10 Task (com.arjuna.services.framework.task.Task)9 TransactionRolledBackException (com.arjuna.wst.TransactionRolledBackException)9 MessageContext (javax.xml.ws.handler.MessageContext)9 Action (javax.xml.ws.Action)7 CoordinationContextType (org.oasis_open.docs.ws_tx.wscoor._2006._06.CoordinationContextType)6 QName (javax.xml.namespace.QName)5 InvalidCreateParametersException (com.arjuna.wsc.InvalidCreateParametersException)4 FaultedException (com.arjuna.wst.FaultedException)4 WrongStateException (com.arjuna.wst.WrongStateException)4 W3CEndpointReference (javax.xml.ws.wsaddressing.W3CEndpointReference)4 CoordinationContext (org.oasis_open.docs.ws_tx.wscoor._2006._06.CoordinationContext)4 TxContextImple (com.arjuna.mwlabs.wst11.at.context.TxContextImple)3