Search in sources :

Example 6 with TerminateSequenceType

use of org.apache.cxf.ws.rm.v200702.TerminateSequenceType in project cxf by apache.

the class Servant method terminateSequence.

public Object terminateSequence(Message message) {
    LOG.fine("Terminating sequence");
    final ProtocolVariation protocol = RMContextUtils.getProtocolVariation(message);
    EncoderDecoder codec = protocol.getCodec();
    TerminateSequenceType terminate = codec.convertReceivedTerminateSequence(getParameter(message));
    // check if the terminated sequence was created in response to a a createSequence
    // request
    Destination destination = reliableEndpoint.getDestination();
    Identifier sid = terminate.getIdentifier();
    DestinationSequence terminatedSeq = destination.getSequence(sid);
    if (null != terminatedSeq) {
        destination.terminateSequence(terminatedSeq);
    }
    // the following may be necessary if the last message for this sequence was a oneway
    // request and hence there was no response to which a last message could have been added
    // REVISIT: A last message for the correlated sequence should have been sent by the time
    // the last message for the underlying sequence was received.
    Source source = reliableEndpoint.getSource();
    for (SourceSequence outboundSeq : source.getAllSequences()) {
        if (outboundSeq.offeredBy(sid) && !outboundSeq.isLastMessage()) {
            if (outboundSeq.getCurrentMessageNr() == 0) {
                source.removeSequence(outboundSeq);
            }
            break;
        }
    }
    TerminateSequenceResponseType terminateResponse = null;
    if (RM11Constants.NAMESPACE_URI.equals(protocol.getWSRMNamespace())) {
        AddressingProperties maps = RMContextUtils.retrieveMAPs(message, false, false);
        Message outMessage = message.getExchange().getOutMessage();
        if (null == outMessage) {
            // outMessage may be null e.g. if ReplyTo is not set for TS
            outMessage = ContextUtils.createMessage(message.getExchange());
            message.getExchange().setOutMessage(outMessage);
        }
        if (null != outMessage) {
            RMContextUtils.storeMAPs(maps, outMessage, false, false);
        }
        terminateResponse = new TerminateSequenceResponseType();
        terminateResponse.setIdentifier(sid);
    }
    return terminateResponse;
}
Also used : TerminateSequenceResponseType(org.apache.cxf.ws.rm.v200702.TerminateSequenceResponseType) Identifier(org.apache.cxf.ws.rm.v200702.Identifier) Message(org.apache.cxf.message.Message) TerminateSequenceType(org.apache.cxf.ws.rm.v200702.TerminateSequenceType) AddressingProperties(org.apache.cxf.ws.addressing.AddressingProperties)

Example 7 with TerminateSequenceType

use of org.apache.cxf.ws.rm.v200702.TerminateSequenceType in project cxf by apache.

the class VersionTransformer method convert.

/**
 * Convert 200502 TerminateSequenceType with 200508 WS-Addressing namespace to internal form.
 *
 * @param exposed (non-<code>null</code>)
 * @return converted
 */
public static TerminateSequenceType convert(org.apache.cxf.ws.rm.v200502wsa15.TerminateSequenceType exposed) {
    TerminateSequenceType internal = new TerminateSequenceType();
    internal.setIdentifier(convert(exposed.getIdentifier()));
    addAll(exposed.getAny(), internal.getAny());
    putAll(exposed.getOtherAttributes(), internal.getOtherAttributes());
    return internal;
}
Also used : TerminateSequenceType(org.apache.cxf.ws.rm.v200702.TerminateSequenceType)

Aggregations

TerminateSequenceType (org.apache.cxf.ws.rm.v200702.TerminateSequenceType)6 BindingOperationInfo (org.apache.cxf.service.model.BindingOperationInfo)3 OperationInfo (org.apache.cxf.service.model.OperationInfo)3 Exchange (org.apache.cxf.message.Exchange)2 ExchangeImpl (org.apache.cxf.message.ExchangeImpl)2 Message (org.apache.cxf.message.Message)2 MessageContentsList (org.apache.cxf.message.MessageContentsList)2 AddressingProperties (org.apache.cxf.ws.addressing.AddressingProperties)2 MessageImpl (org.apache.cxf.message.MessageImpl)1 BindingInfo (org.apache.cxf.service.model.BindingInfo)1 AttributedURIType (org.apache.cxf.ws.addressing.AttributedURIType)1 Identifier (org.apache.cxf.ws.rm.v200502.Identifier)1 TerminateSequenceType (org.apache.cxf.ws.rm.v200502.TerminateSequenceType)1 Identifier (org.apache.cxf.ws.rm.v200702.Identifier)1 TerminateSequenceResponseType (org.apache.cxf.ws.rm.v200702.TerminateSequenceResponseType)1