Search in sources :

Example 6 with SoapFaultType

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

the class SoapFault11 method create.

public static SoapFault11 create(SOAPFaultException sfe) {
    try {
        SOAPFault cause = sfe.getFault();
        QName faultCode = cause.getFaultCodeAsQName();
        String reason = cause.getFaultString();
        SoapFaultType soapFaultType = SoapFaultType.toState(reason);
        Detail detail = cause.getDetail();
        return new SoapFault11(soapFaultType, faultCode, null, detail);
    } catch (InvalidEnumerationException e) {
        return new SoapFault11(e);
    }
}
Also used : SoapFaultType(com.arjuna.webservices.SoapFaultType) QName(javax.xml.namespace.QName) SOAPFault(javax.xml.soap.SOAPFault) InvalidEnumerationException(com.arjuna.webservices.util.InvalidEnumerationException) Detail(javax.xml.soap.Detail)

Example 7 with SoapFaultType

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

the class ParticipantEngine method soapFault.

/**
 * Handle the soap fault event.
 * @param soapFault The soap fault.
 * @param map The addressing context.
 * @param arjunaContext The arjuna context.
 */
public void soapFault(final SoapFault soapFault, final MAP map, final ArjunaContext arjunaContext) {
    if (WSTLogger.logger.isTraceEnabled()) {
        final InstanceIdentifier instanceIdentifier = arjunaContext.getInstanceIdentifier();
        final SoapFaultType soapFaultType = soapFault.getSoapFaultType();
        final QName subCode = soapFault.getSubcode();
        WSTLogger.logger.tracev("Unexpected SOAP fault for participant {0}: {1} {2}", new Object[] { instanceIdentifier, soapFaultType, subCode });
    }
    QName subcode = soapFault.getSubcode();
    if (CoordinationConstants.WSCOOR_ERROR_CODE_INVALID_STATE_QNAME.equals(subcode) || AtomicTransactionConstants.WSAT_ERROR_CODE_INCONSISTENT_INTERNAL_STATE_QNAME.equals(subcode) || AtomicTransactionConstants.WSAT_ERROR_CODE_UNKNOWN_TRANSACTION_QNAME.equals(subcode)) {
        final SoapFaultType soapFaultType = soapFault.getSoapFaultType();
        final QName subCode = soapFault.getSubcode();
        WSTLogger.i18NLogger.error_wst11_messaging_engines_ParticipantEngine_soapFault_2(id, soapFaultType.toString(), subCode);
        // unrecoverable error -- forget this participant and delete any persistent
        // record of it
        final State current;
        synchronized (this) {
            current = state;
            state = null;
        }
        if (current == State.STATE_PREPARED_SUCCESS && AtomicTransactionConstants.WSAT_ERROR_CODE_UNKNOWN_TRANSACTION_QNAME.equals(subcode)) {
            // we need to tell this participant to roll back
            executeRollback();
        }
        if (persisted && participant instanceof Durable2PCParticipant) {
            // remove any durable participant recovery record from the persistent store
            Durable2PCParticipant durableParticipant = (Durable2PCParticipant) participant;
            // if we cannot delete the participant we record an error here
            if (!XTSATRecoveryManager.getRecoveryManager().deleteParticipantRecoveryRecord(id)) {
                // hmm, could not delete entry -- log an error
                WSTLogger.i18NLogger.error_wst11_messaging_engines_ParticipantEngine_soapFault_3(id);
            }
        }
        forget();
    }
}
Also used : SoapFaultType(com.arjuna.webservices.SoapFaultType) QName(javax.xml.namespace.QName) State(com.arjuna.webservices11.wsat.State) InstanceIdentifier(com.arjuna.webservices11.wsarj.InstanceIdentifier)

Example 8 with SoapFaultType

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

the class CoordinatorEngine method soapFault.

/**
 * Handle the soap fault event.
 * @param soapFault The soap fault.
 * @param map The addressing context.
 * @param arjunaContext The arjuna context.
 */
public void soapFault(final SoapFault soapFault, final MAP map, final ArjunaContext arjunaContext) {
    if (WSTLogger.logger.isTraceEnabled()) {
        final InstanceIdentifier instanceIdentifier = arjunaContext.getInstanceIdentifier();
        final SoapFaultType soapFaultType = soapFault.getSoapFaultType();
        final QName subCode = soapFault.getSubcode();
        WSTLogger.logger.tracev("Unexpected SOAP fault for coordinator {0}: {1} {2}", new Object[] { instanceIdentifier, soapFaultType, subCode });
    }
}
Also used : SoapFaultType(com.arjuna.webservices.SoapFaultType) QName(javax.xml.namespace.QName) InstanceIdentifier(com.arjuna.webservices11.wsarj.InstanceIdentifier)

Example 9 with SoapFaultType

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

the class BusinessAgreementWithParticipantCompletionParticipantTest method testSendError.

@Test
public void testSendError() throws Exception {
    final String messageId = "testSendError";
    final MAP map = AddressingHelper.createRequestContext(TestUtil.participantCompletionCoordinatorServiceURI, messageId);
    final InstanceIdentifier instanceIdentifier = new InstanceIdentifier("6");
    final String reason = "testSendErrorReason";
    final SoapFaultType soapFaultType = SoapFaultType.FAULT_SENDER;
    final QName subcode = ArjunaTXConstants.UNKNOWNERROR_ERROR_CODE_QNAME;
    final SoapFault11 soapFault = new SoapFault11(soapFaultType, subcode, reason);
    ParticipantCompletionCoordinatorClient.getClient().sendSoapFault(soapFault, null, map, TestUtil.getBusinessActivityFaultAction());
    final ParticipantCompletionCoordinatorDetails details = testParticipantCompletionCoordinatorProcessor.getParticipantCompletionCoordinatorDetails(messageId, 10000);
    assertNotNull(details.hasSoapFault());
    assertEquals(details.hasSoapFault().getSoapFaultType(), soapFault.getSoapFaultType());
    assertEquals(details.hasSoapFault().getSubcode(), soapFault.getSubcode());
    assertEquals(details.hasSoapFault().getReason(), soapFault.getReason());
    checkDetails(details, false, false, messageId, null);
}
Also used : SoapFaultType(com.arjuna.webservices.SoapFaultType) ParticipantCompletionCoordinatorDetails(com.arjuna.wst.tests.arq.TestParticipantCompletionCoordinatorProcessor.ParticipantCompletionCoordinatorDetails) QName(javax.xml.namespace.QName) InstanceIdentifier(com.arjuna.webservices11.wsarj.InstanceIdentifier) SoapFault11(com.arjuna.webservices11.SoapFault11) MAP(org.jboss.ws.api.addressing.MAP) Test(org.junit.Test)

Example 10 with SoapFaultType

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

the class TwoPCParticipantTest method testSendError.

@Test
public void testSendError() throws Exception {
    final String messageId = "testSendError";
    final InstanceIdentifier instanceIdentifier = new InstanceIdentifier("5");
    W3CEndpointReference coordinatorEndpoint = TestUtil.getCoordinatorEndpoint(instanceIdentifier.getInstanceIdentifier());
    final MAP map = AddressingHelper.createRequestContext(TestUtil.coordinatorServiceURI, messageId);
    final String reason = "testSendErrorReason";
    final SoapFaultType soapFaultType = SoapFaultType.FAULT_SENDER;
    final QName subcode = ArjunaTXConstants.UNKNOWNERROR_ERROR_CODE_QNAME;
    final SoapFault11 soapFault = new SoapFault11(soapFaultType, subcode, reason);
    CoordinatorClient.getClient().sendSoapFault(coordinatorEndpoint, map, soapFault, new InstanceIdentifier("sender"));
    CoordinatorDetails details = testCoordinatorProcessor.getCoordinatorDetails(messageId, 10000);
    assertNotNull(details.hasSoapFault());
    assertEquals(details.hasSoapFault().getSoapFaultType(), soapFault.getSoapFaultType());
    assertEquals(details.hasSoapFault().getReason(), soapFault.getReason());
    assertEquals(details.hasSoapFault().getSubcode(), soapFault.getSubcode());
    checkDetails(details, false, false, messageId, instanceIdentifier);
}
Also used : CoordinatorDetails(com.arjuna.wst.tests.arq.TestCoordinatorProcessor.CoordinatorDetails) SoapFaultType(com.arjuna.webservices.SoapFaultType) W3CEndpointReference(javax.xml.ws.wsaddressing.W3CEndpointReference) QName(javax.xml.namespace.QName) InstanceIdentifier(com.arjuna.webservices11.wsarj.InstanceIdentifier) SoapFault11(com.arjuna.webservices11.SoapFault11) MAP(org.jboss.ws.api.addressing.MAP) Test(org.junit.Test)

Aggregations

SoapFaultType (com.arjuna.webservices.SoapFaultType)10 QName (javax.xml.namespace.QName)10 InstanceIdentifier (com.arjuna.webservices11.wsarj.InstanceIdentifier)9 SoapFault11 (com.arjuna.webservices11.SoapFault11)7 MAP (org.jboss.ws.api.addressing.MAP)7 Test (org.junit.Test)7 SoapFault (com.arjuna.webservices.SoapFault)2 W3CEndpointReference (javax.xml.ws.wsaddressing.W3CEndpointReference)2 InvalidEnumerationException (com.arjuna.webservices.util.InvalidEnumerationException)1 ArjunaContext (com.arjuna.webservices11.wsarj.ArjunaContext)1 State (com.arjuna.webservices11.wsat.State)1 CompletionInitiatorProcessor (com.arjuna.webservices11.wsat.processors.CompletionInitiatorProcessor)1 CoordinatorCompletionCoordinatorDetails (com.arjuna.wst.tests.arq.TestCoordinatorCompletionCoordinatorProcessor.CoordinatorCompletionCoordinatorDetails)1 CoordinatorCompletionParticipantDetails (com.arjuna.wst.tests.arq.TestCoordinatorCompletionParticipantProcessor.CoordinatorCompletionParticipantDetails)1 CoordinatorDetails (com.arjuna.wst.tests.arq.TestCoordinatorProcessor.CoordinatorDetails)1 ParticipantCompletionCoordinatorDetails (com.arjuna.wst.tests.arq.TestParticipantCompletionCoordinatorProcessor.ParticipantCompletionCoordinatorDetails)1 ParticipantCompletionParticipantDetails (com.arjuna.wst.tests.arq.TestParticipantCompletionParticipantProcessor.ParticipantCompletionParticipantDetails)1 ParticipantDetails (com.arjuna.wst.tests.arq.TestParticipantProcessor.ParticipantDetails)1 Detail (javax.xml.soap.Detail)1 SOAPFault (javax.xml.soap.SOAPFault)1