Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix wsa message id issue #2178

Merged
merged 1 commit into from
May 29, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@
import org.apache.synapse.util.ResponseAcceptEncodingProcessor;

import java.util.Iterator;
import java.util.Objects;
import java.util.Stack;
import java.util.Timer;

Expand Down Expand Up @@ -160,16 +161,9 @@ public void receive(MessageContext messageCtx) throws AxisFault {
return;
}


if (messageCtx.getOptions() != null && messageCtx.getOptions().getRelatesTo() != null) {
// never take a chance with a NPE at this stage.. so check at each level :-)
Options options = messageCtx.getOptions();
if (options != null) {
RelatesTo relatesTo = options.getRelatesTo();
if (relatesTo != null) {
messageID = relatesTo.getValue();
}
}
String relatesTo = extractRelatesToFromResponse(messageCtx);
if (relatesTo != null && !isRelatesToUnspecified(relatesTo)) {
messageID = relatesTo;
} else if (messageCtx.getProperty(SynapseConstants.SANDESHA2_SEQUENCE_KEY) == null) {
messageID = (String) messageCtx.getProperty(SynapseConstants.RELATES_TO_FOR_POX);
}
Expand Down Expand Up @@ -229,6 +223,26 @@ public void receive(MessageContext messageCtx) throws AxisFault {
}
}

private String extractRelatesToFromResponse(MessageContext messageCtx) {
if (messageCtx.getOptions() != null && messageCtx.getOptions().getRelatesTo() != null) {
// never take a chance with a NPE at this stage.. so check at each level :-)
Options options = messageCtx.getOptions();
if (options != null) {
RelatesTo relatesTo = options.getRelatesTo();
if (relatesTo != null) {
return relatesTo.getValue();
}
}
}
return null;
}

private boolean isRelatesToUnspecified(String relatesTo) {

return relatesTo.equals("http://schemas.xmlsoap.org/ws/2004/08/addressing/id/unspecified")
|| relatesTo.equals("http://www.w3.org/2005/08/addressing/unspecified");
}

/**
* Handle the response or error (during a failed send) message received for an outgoing request
*
Expand Down
Loading