Search in sources :

Example 86 with InstanceIdentifier

use of com.arjuna.webservices11.wsarj.InstanceIdentifier in project narayana by jbosstm.

the class InstanceIdentifierHandler method handleMessageOutbound.

/**
 * check for an arjuna context attached to the message context and, if found, install its identifier as the value
 * of a soap message header element
 * @param context
 * @return
 * @throws ProtocolException
 */
protected boolean handleMessageOutbound(SOAPMessageContext context) throws ProtocolException {
    try {
        ArjunaContext arjunaContext = ArjunaContext.getCurrentContext(context);
        if (arjunaContext != null) {
            InstanceIdentifier instanceIdentifier = arjunaContext.getInstanceIdentifier();
            // insert a header into the current message containing the instance identifier as a text element
            final SOAPMessage soapMessage = context.getMessage();
            final SOAPEnvelope soapEnvelope = soapMessage.getSOAPPart().getEnvelope();
            SOAPHeader soapHeader = soapEnvelope.getHeader();
            if (soapHeader == null) {
                soapHeader = soapEnvelope.addHeader();
            }
            final SOAPHeaderElement headerElement = soapHeader.addHeaderElement(ArjunaConstants.WSARJ_ELEMENT_INSTANCE_IDENTIFIER_QNAME);
            headerElement.setValue(instanceIdentifier.getInstanceIdentifier());
            headerElement.setMustUnderstand(true);
        }
    } catch (Exception se) {
        throw new ProtocolException(se);
    }
    return true;
}
Also used : SOAPHeaderElement(javax.xml.soap.SOAPHeaderElement) ProtocolException(javax.xml.ws.ProtocolException) InstanceIdentifier(com.arjuna.webservices11.wsarj.InstanceIdentifier) SOAPEnvelope(javax.xml.soap.SOAPEnvelope) ArjunaContext(com.arjuna.webservices11.wsarj.ArjunaContext) SOAPMessage(javax.xml.soap.SOAPMessage) SOAPHeader(javax.xml.soap.SOAPHeader) ProtocolException(javax.xml.ws.ProtocolException)

Example 87 with InstanceIdentifier

use of com.arjuna.webservices11.wsarj.InstanceIdentifier in project narayana by jbosstm.

the class CoordinatorCompletionParticipantProcessorImpl method exited.

/**
 * Exited.
 * @param exited The exited notification.
 * @param map The addressing context.
 * @param arjunaContext The arjuna context.
 */
public void exited(final NotificationType exited, final MAP map, final ArjunaContext arjunaContext) {
    final InstanceIdentifier instanceIdentifier = arjunaContext.getInstanceIdentifier();
    final CoordinatorCompletionParticipantInboundEvents participant = getParticipant(instanceIdentifier);
    if (participant != null) {
        try {
            participant.exited(exited, map, arjunaContext);
        } catch (final Throwable th) {
            if (WSTLogger.logger.isTraceEnabled()) {
                WSTLogger.logger.tracev("Unexpected exception thrown from exited:", th);
            }
        }
    } else if (WSTLogger.logger.isTraceEnabled()) {
        WSTLogger.logger.tracev("Exited called on unknown participant: {0}", new Object[] { instanceIdentifier });
    }
}
Also used : InstanceIdentifier(com.arjuna.webservices11.wsarj.InstanceIdentifier) CoordinatorCompletionParticipantInboundEvents(com.arjuna.webservices11.wsba.CoordinatorCompletionParticipantInboundEvents)

Example 88 with InstanceIdentifier

use of com.arjuna.webservices11.wsarj.InstanceIdentifier in project narayana by jbosstm.

the class CoordinatorCompletionParticipantProcessorImpl method soapFault.

/**
 * SOAP Fault.
 * @param fault The SOAP fault notification.
 * @param map The addressing context.
 * @param arjunaContext The arjuna context.
 */
public void soapFault(final SoapFault fault, final MAP map, final ArjunaContext arjunaContext) {
    final InstanceIdentifier instanceIdentifier = arjunaContext.getInstanceIdentifier();
    final CoordinatorCompletionParticipantInboundEvents participant = getParticipant(instanceIdentifier);
    if (participant != null) {
        try {
            participant.soapFault(fault, map, arjunaContext);
        } catch (final Throwable th) {
            if (WSTLogger.logger.isTraceEnabled()) {
                WSTLogger.logger.tracev("Unexpected exception thrown from soapFault:", th);
            }
        }
    } else if (WSTLogger.logger.isTraceEnabled()) {
        WSTLogger.logger.tracev("SoapFault called on unknown participant: {0}", new Object[] { instanceIdentifier });
    }
}
Also used : InstanceIdentifier(com.arjuna.webservices11.wsarj.InstanceIdentifier) CoordinatorCompletionParticipantInboundEvents(com.arjuna.webservices11.wsba.CoordinatorCompletionParticipantInboundEvents)

Example 89 with InstanceIdentifier

use of com.arjuna.webservices11.wsarj.InstanceIdentifier in project narayana by jbosstm.

the class CoordinatorCompletionParticipantProcessorImpl method notCompleted.

/**
 * Not Completed.
 * @param notCompleted The not completed notification.
 * @param map The addressing context.
 * @param arjunaContext The arjuna context.
 */
public void notCompleted(final NotificationType notCompleted, final MAP map, final ArjunaContext arjunaContext) {
    final InstanceIdentifier instanceIdentifier = arjunaContext.getInstanceIdentifier();
    final CoordinatorCompletionParticipantInboundEvents participant = getParticipant(instanceIdentifier);
    if (participant != null) {
        try {
            participant.notCompleted(notCompleted, map, arjunaContext);
        } catch (final Throwable th) {
            if (WSTLogger.logger.isTraceEnabled()) {
                WSTLogger.logger.tracev("Unexpected exception thrown from notCompleted:", th);
            }
        }
    } else if (WSTLogger.logger.isTraceEnabled()) {
        WSTLogger.logger.tracev("NotCompleted called on unknown participant: {0}", new Object[] { instanceIdentifier });
    }
}
Also used : InstanceIdentifier(com.arjuna.webservices11.wsarj.InstanceIdentifier) CoordinatorCompletionParticipantInboundEvents(com.arjuna.webservices11.wsba.CoordinatorCompletionParticipantInboundEvents)

Example 90 with InstanceIdentifier

use of com.arjuna.webservices11.wsarj.InstanceIdentifier in project narayana by jbosstm.

the class CoordinatorCompletionParticipantProcessorImpl method getStatus.

/**
 * Get Status.
 * @param getStatus The get status notification.
 * @param map The addressing context.
 * @param arjunaContext The arjuna context.
 */
public void getStatus(final NotificationType getStatus, final MAP map, final ArjunaContext arjunaContext) {
    final InstanceIdentifier instanceIdentifier = arjunaContext.getInstanceIdentifier();
    final CoordinatorCompletionParticipantInboundEvents participant = getParticipant(instanceIdentifier);
    if (participant != null) {
        try {
            participant.getStatus(getStatus, map, arjunaContext);
        } catch (final Throwable th) {
            if (WSTLogger.logger.isTraceEnabled()) {
                WSTLogger.logger.tracev("Unexpected exception thrown from getStatus:", th);
            }
        }
    } else {
        if (WSTLogger.logger.isTraceEnabled()) {
            WSTLogger.logger.tracev("GetStatus called on unknown participant: {0}", new Object[] { instanceIdentifier });
        }
        // send an invalid state fault
        final String messageId = MessageId.getMessageId();
        final MAP faultMAP = AddressingHelper.createFaultContext(map, messageId);
        try {
            final SoapFault11 soapFault = new SoapFault11(SoapFaultType.FAULT_SENDER, CoordinationConstants.WSCOOR_ERROR_CODE_INVALID_STATE_QNAME, WSTLogger.i18NLogger.get_wst11_messaging_CoordinatorCompletionParticipantProcessorImpl_getStatus_4());
            CoordinatorCompletionCoordinatorClient.getClient().sendSoapFault(soapFault, null, faultMAP, getFaultAction());
        } catch (final Throwable th) {
            WSTLogger.i18NLogger.info_wst11_messaging_CoordinatorCompletionParticipantProcessorImpl_getStatus_3(instanceIdentifier.toString(), th);
        }
    }
}
Also used : InstanceIdentifier(com.arjuna.webservices11.wsarj.InstanceIdentifier) SoapFault11(com.arjuna.webservices11.SoapFault11) MAP(org.jboss.ws.api.addressing.MAP) CoordinatorCompletionParticipantInboundEvents(com.arjuna.webservices11.wsba.CoordinatorCompletionParticipantInboundEvents)

Aggregations

InstanceIdentifier (com.arjuna.webservices11.wsarj.InstanceIdentifier)130 MAP (org.jboss.ws.api.addressing.MAP)83 W3CEndpointReference (javax.xml.ws.wsaddressing.W3CEndpointReference)53 Test (org.junit.Test)51 SoapFault11 (com.arjuna.webservices11.SoapFault11)24 SoapFault (com.arjuna.webservices.SoapFault)20 ArjunaContext (com.arjuna.webservices11.wsarj.ArjunaContext)13 SystemException (com.arjuna.wst.SystemException)13 UnknownTransactionException (com.arjuna.wst.UnknownTransactionException)13 QName (javax.xml.namespace.QName)12 CoordinatorCompletionCoordinatorInboundEvents (com.arjuna.webservices11.wsba.CoordinatorCompletionCoordinatorInboundEvents)10 CoordinatorCompletionParticipantInboundEvents (com.arjuna.webservices11.wsba.CoordinatorCompletionParticipantInboundEvents)10 ParticipantCompletionCoordinatorInboundEvents (com.arjuna.webservices11.wsba.ParticipantCompletionCoordinatorInboundEvents)10 CoordinatorCompletionParticipantDetails (com.arjuna.wst.tests.arq.TestCoordinatorCompletionParticipantProcessor.CoordinatorCompletionParticipantDetails)10 ParticipantCompletionCoordinatorDetails (com.arjuna.wst.tests.arq.TestParticipantCompletionCoordinatorProcessor.ParticipantCompletionCoordinatorDetails)10 SoapFaultType (com.arjuna.webservices.SoapFaultType)9 ParticipantCompletionParticipantInboundEvents (com.arjuna.webservices11.wsba.ParticipantCompletionParticipantInboundEvents)9 CoordinatorCompletionCoordinatorDetails (com.arjuna.wst.tests.arq.TestCoordinatorCompletionCoordinatorProcessor.CoordinatorCompletionCoordinatorDetails)9 ParticipantCompletionParticipantDetails (com.arjuna.wst.tests.arq.TestParticipantCompletionParticipantProcessor.ParticipantCompletionParticipantDetails)9 ProtocolException (javax.xml.ws.ProtocolException)9