// to http://schemas.xmlsoap.org/ws/2004/a08/addressing/fault
// but: need to defer propagation of received MAPS to outbound chain first
return;
}
AddressingPropertiesImpl maps = RMContextUtils.retrieveMAPs(msg, false, true);
if (null == maps) {
LogUtils.log(LOG, Level.WARNING, "MAPS_RETRIEVAL_FAILURE_MSG");
return;
}
Source source = getManager().getSource(msg);
ProtocolVariation protocol = source.getReliableEndpoint().getProtocol();
maps.exposeAs(protocol.getWSANamespace());
Destination destination = getManager().getDestination(msg);
String action = null;
if (null != maps.getAction()) {
action = maps.getAction().getValue();
}
if (LOG.isLoggable(Level.FINE)) {
LOG.fine("Action: " + action);
}
boolean isApplicationMessage = !RMContextUtils.isRMProtocolMessage(action);
boolean isPartialResponse = MessageUtils.isPartialResponse(msg);
RMConstants constants = protocol.getConstants();
boolean isLastMessage = constants.getCloseSequenceAction().equals(action);
if (isApplicationMessage && !isPartialResponse) {
RetransmissionInterceptor ri = new RetransmissionInterceptor();
ri.setManager(getManager());
// TODO:
// On the server side: If a fault occurs after this interceptor we will switch
// interceptor chains (if this is not already a fault message) and therefore need to
// make sure the retransmission interceptor is added to the fault chain
//
msg.getInterceptorChain().add(ri);
LOG.fine("Added RetransmissionInterceptor to chain.");
getManager().getRetransmissionQueue().start();
}
RMProperties rmpsOut = RMContextUtils.retrieveRMProperties(msg, true);
if (null == rmpsOut) {
rmpsOut = new RMProperties();
rmpsOut.exposeAs(protocol.getWSRMNamespace());
RMContextUtils.storeRMProperties(msg, rmpsOut, true);
}
RMProperties rmpsIn = null;
Identifier inSeqId = null;
long inMessageNumber = 0;
if (isApplicationMessage) {
rmpsIn = RMContextUtils.retrieveRMProperties(msg, false);
if (null != rmpsIn && null != rmpsIn.getSequence()) {
inSeqId = rmpsIn.getSequence().getIdentifier();
inMessageNumber = rmpsIn.getSequence().getMessageNumber();
}
ContextUtils.storeDeferUncorrelatedMessageAbort(msg);
}
if ((isApplicationMessage || isLastMessage)
&& !isPartialResponse) {
if (LOG.isLoggable(Level.FINE)) {
LOG.fine("inbound sequence: " + (null == inSeqId ? "null" : inSeqId.getValue()));
}
// get the current sequence, requesting the creation of a new one if necessary
synchronized (source) {
SourceSequence seq = null;
if (isLastMessage) {
Map<?, ?> invocationContext = (Map)msg.get(Message.INVOCATION_CONTEXT);
seq = (SourceSequence)invocationContext.get(SourceSequence.class.getName());
} else {
seq = getManager().getSequence(inSeqId, msg, maps);
}
assert null != seq;
// increase message number and store a sequence type object in
// context
seq.nextMessageNumber(inSeqId, inMessageNumber, isLastMessage);
if (Boolean.TRUE.equals(msg.getContextualProperty(RMManager.WSRM_LAST_MESSAGE_PROPERTY))) {
// mark the message as the last one
seq.setLastMessage(true);
}
rmpsOut.setSequence(seq);
// if this was the last message in the sequence, reset the
// current sequence so that a new one will be created next
// time the handler is invoked
if (seq.isLastMessage()) {
source.setCurrent(null);
}
}
} else if (!MessageUtils.isRequestor(msg) && constants.getCreateSequenceAction().equals(action)) {
maps.getAction().setValue(constants.getCreateSequenceResponseAction());
}
// add Acknowledgements (to application messages or explicitly
// created Acknowledgement messages only)
if (isApplicationMessage || constants.getSequenceAckAction().equals(action)) {
AttributedURIType to = maps.getTo();
assert null != to;
addAcknowledgements(destination, rmpsOut, inSeqId, to);
if (isPartialResponse && rmpsOut.getAcks() != null && rmpsOut.getAcks().size() > 0) {
AttributedURIType actionURI = new AttributedURIType();
actionURI.setValue(constants.getSequenceAckAction());
maps.setAction(actionURI);
msg.remove(Message.EMPTY_PARTIAL_RESPONSE_MESSAGE);
}
}
if (constants.getSequenceAckAction().equals(action)
|| constants.getTerminateSequenceAction().equals(action)) {
maps.setReplyTo(RMUtils.createNoneReference());
}
assertReliability(msg);
}