Search in sources :

Example 1 with InstanceIdentifier

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

the class CompletionInitiatorClient method sendSoapFault.

/**
 * Send a fault for an unknown participant.
 * @param map The addressing context.
 * @param soapFault The SOAP fault.
 * @param identifier The arjuna instance identifier.
 * @throws com.arjuna.webservices.SoapFault For any errors.
 * @throws java.io.IOException for any transport errors.
 */
public void sendSoapFault(final MAP map, final SoapFault soapFault, final InstanceIdentifier identifier) throws SoapFault, IOException {
    CompletionInitiatorPortType port = getPort(null, map, faultAction);
    // convert fault to the wire format and dispatch it to the initiator
    soapFault.setAction(faultAction);
    Fault fault = ((SoapFault11) soapFault).toFault();
    port.soapFault(fault);
}
Also used : SoapFault(com.arjuna.webservices.SoapFault) Fault(org.xmlsoap.schemas.soap.envelope.Fault) SoapFault11(com.arjuna.webservices11.SoapFault11) CompletionInitiatorPortType(org.oasis_open.docs.ws_tx.wsat._2006._06.CompletionInitiatorPortType)

Example 2 with InstanceIdentifier

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

the class CompletionInitiatorClient method sendSoapFault.

/**
 * Send a fault.
 * @param map The addressing context.
 * @param soapFault The SOAP fault.
 * @param identifier The arjuna instance identifier.
 * @throws com.arjuna.webservices.SoapFault For any errors.
 * @throws java.io.IOException for any transport errors.
 */
public void sendSoapFault(final W3CEndpointReference participant, final MAP map, final SoapFault soapFault, final InstanceIdentifier identifier) throws SoapFault, IOException {
    CompletionInitiatorPortType port = getPort(participant, map, faultAction);
    // convert fault to the wire format and dispatch it to the initiator
    soapFault.setAction(faultAction);
    Fault fault = ((SoapFault11) soapFault).toFault();
    port.soapFault(fault);
}
Also used : SoapFault(com.arjuna.webservices.SoapFault) Fault(org.xmlsoap.schemas.soap.envelope.Fault) SoapFault11(com.arjuna.webservices11.SoapFault11) CompletionInitiatorPortType(org.oasis_open.docs.ws_tx.wsat._2006._06.CompletionInitiatorPortType)

Example 3 with InstanceIdentifier

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

the class ParticipantClient method sendSoapFault.

/**
 * Send a fault.
 * @param map The addressing context.
 * @param soapFault The SOAP fault.
 * @param identifier The arjuna instance identifier.
 * @throws com.arjuna.webservices.SoapFault For any errors.
 * @throws java.io.IOException for any transport errors.
 */
public void sendSoapFault(final MAP map, final SoapFault soapFault, final InstanceIdentifier identifier) throws SoapFault, IOException {
    ParticipantPortType port = getPort(null, map, faultAction);
    // convert fault to the wire format and dispatch it to the initiator
    soapFault.setAction(faultAction);
    Fault fault = ((SoapFault11) soapFault).toFault();
    port.soapFault(fault);
}
Also used : ParticipantPortType(org.oasis_open.docs.ws_tx.wsat._2006._06.ParticipantPortType) SoapFault(com.arjuna.webservices.SoapFault) Fault(org.xmlsoap.schemas.soap.envelope.Fault) SoapFault11(com.arjuna.webservices11.SoapFault11)

Example 4 with InstanceIdentifier

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

the class TerminationParticipantClient method sendSoapFault.

/**
 * Send a fault.
 * @param map The addressing context.
 * @param soapFault The SOAP fault.
 * @param identifier The arjuna  instance identifier.
 * @throws com.arjuna.webservices.SoapFault For any errors.
 * @throws java.io.IOException for any transport errors.
 */
public void sendSoapFault(final SoapFault soapFault, final MAP map, final InstanceIdentifier identifier) throws SoapFault, IOException {
    final TerminationParticipantPortType port = getPort(map, identifier, soapFaultAction);
    SoapFault11 soapFault11 = (SoapFault11) soapFault;
    Fault fault = soapFault11.toFault();
    port.faultOperation(fault);
}
Also used : TerminationParticipantPortType(com.arjuna.schemas.ws._2005._10.wsarjtx.TerminationParticipantPortType) SoapFault11(com.arjuna.webservices11.SoapFault11) SoapFault(com.arjuna.webservices.SoapFault) Fault(org.xmlsoap.schemas.soap.envelope.Fault)

Example 5 with InstanceIdentifier

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

the class RegistrationCoordinatorProcessorImpl method register.

/**
 * Register the participant in the protocol.
 * @param register The register request.
 * @param map The addressing context.
 * @param arjunaContext The arjuna context.
 */
public RegisterResponseType register(final RegisterType register, final MAP map, final ArjunaContext arjunaContext, final boolean isSecure) {
    final com.arjuna.wsc11.RegistrarMapper registrarMapper = RegistrarMapper.getFactory();
    try {
        final String protocolIdentifier = register.getProtocolIdentifier();
        final Registrar registrar = registrarMapper.getRegistrar(protocolIdentifier);
        if (registrar != null) {
            try {
                final W3CEndpointReference participantProtocolService = register.getParticipantProtocolService();
                final InstanceIdentifier instanceIdentifier = arjunaContext.getInstanceIdentifier();
                final W3CEndpointReference coordinationProtocolService = registrar.register(participantProtocolService, protocolIdentifier, instanceIdentifier, isSecure);
                final RegisterResponseType response = new RegisterResponseType();
                response.setCoordinatorProtocolService(coordinationProtocolService);
                return response;
            } catch (final AlreadyRegisteredException alreadyRegisteredException) {
                SOAPFactory factory = SOAPFactory.newInstance();
                SOAPFault soapFault = factory.createFault(SoapFaultType.FAULT_SENDER.getValue(), CoordinationConstants.WSCOOR_ERROR_CODE_CANNOT_REGISTER_QNAME);
                soapFault.addDetail().addDetailEntry(CoordinationConstants.WSCOOR_ERROR_CODE_CANNOT_REGISTER_QNAME).addTextNode(WSCLogger.i18NLogger.get_wsc11_messaging_RegistrationCoordinatorProcessorImpl_1());
                throw new SOAPFaultException(soapFault);
            } catch (final InvalidProtocolException invalidProtocolException) {
                SOAPFactory factory = SOAPFactory.newInstance();
                SOAPFault soapFault = factory.createFault(SoapFaultType.FAULT_SENDER.getValue(), CoordinationConstants.WSCOOR_ERROR_CODE_INVALID_PROTOCOL_QNAME);
                soapFault.addDetail().addDetailEntry(CoordinationConstants.WSCOOR_ERROR_CODE_INVALID_PARAMETERS_QNAME).addTextNode(WSCLogger.i18NLogger.get_wsc11_messaging_RegistrationCoordinatorProcessorImpl_2());
                throw new SOAPFaultException(soapFault);
            } catch (final InvalidStateException InvalidStateException) {
                SOAPFactory factory = SOAPFactory.newInstance();
                SOAPFault soapFault = factory.createFault(SoapFaultType.FAULT_SENDER.getValue(), CoordinationConstants.WSCOOR_ERROR_CODE_INVALID_STATE_QNAME);
                soapFault.addDetail().addDetailEntry(CoordinationConstants.WSCOOR_ERROR_CODE_INVALID_STATE_QNAME).addTextNode(WSCLogger.i18NLogger.get_wsc11_messaging_RegistrationCoordinatorProcessorImpl_3());
                throw new SOAPFaultException(soapFault);
            } catch (final NoActivityException noActivityException) {
                SOAPFactory factory = SOAPFactory.newInstance();
                SOAPFault soapFault = factory.createFault(SoapFaultType.FAULT_SENDER.getValue(), CoordinationConstants.WSCOOR_ERROR_CODE_CANNOT_REGISTER_QNAME);
                soapFault.addDetail().addDetailEntry(CoordinationConstants.WSCOOR_ERROR_CODE_CANNOT_REGISTER_QNAME).addTextNode(WSCLogger.i18NLogger.get_wsc11_messaging_RegistrationCoordinatorProcessorImpl_4());
                throw new SOAPFaultException(soapFault);
            } catch (final Throwable th) {
                if (WSCLogger.logger.isTraceEnabled()) {
                    WSCLogger.logger.tracev("Unexpected exception thrown from create:", th);
                }
                SOAPFactory factory = SOAPFactory.newInstance();
                SOAPFault soapFault = factory.createFault(SoapFaultType.FAULT_SENDER.getValue(), CoordinationConstants.WSCOOR_ERROR_CODE_CANNOT_REGISTER_QNAME);
                soapFault.addDetail().addDetailEntry(CoordinationConstants.WSCOOR_ERROR_CODE_CANNOT_REGISTER_QNAME).addTextNode(th.getMessage());
                throw new SOAPFaultException(soapFault);
            }
        } else {
            if (WSCLogger.logger.isTraceEnabled()) {
                WSCLogger.logger.tracev("Register called for unknown protocol identifier: {0}", new Object[] { protocolIdentifier });
            }
            SOAPFactory factory = SOAPFactory.newInstance();
            SOAPFault soapFault = factory.createFault(SoapFaultType.FAULT_SENDER.getValue(), CoordinationConstants.WSCOOR_ERROR_CODE_INVALID_PROTOCOL_QNAME);
            soapFault.addDetail().addDetailEntry(CoordinationConstants.WSCOOR_ERROR_CODE_INVALID_PARAMETERS_QNAME).addTextNode(WSCLogger.i18NLogger.get_wsc11_messaging_RegistrationCoordinatorProcessorImpl_2());
            throw new SOAPFaultException(soapFault);
        }
    } catch (SOAPException se) {
        se.printStackTrace(System.err);
        throw new ProtocolException(se);
    }
}
Also used : ProtocolException(javax.xml.ws.ProtocolException) SOAPFaultException(javax.xml.ws.soap.SOAPFaultException) SOAPFactory(javax.xml.soap.SOAPFactory) RegisterResponseType(org.oasis_open.docs.ws_tx.wscoor._2006._06.RegisterResponseType) Registrar(com.arjuna.wsc11.Registrar) W3CEndpointReference(javax.xml.ws.wsaddressing.W3CEndpointReference) SOAPException(javax.xml.soap.SOAPException) RegistrarMapper(com.arjuna.wsc11.RegistrarMapper) InstanceIdentifier(com.arjuna.webservices11.wsarj.InstanceIdentifier) SOAPFault(javax.xml.soap.SOAPFault)

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