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);
}
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);
}
}
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();
}
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();
}
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();
}
Aggregations