Skip to content

Commit

Permalink
Merge pull request #2178 from IsuruMaduranga/mi.internal#752
Browse files Browse the repository at this point in the history
Fix wsa message id issue
  • Loading branch information
IsuruMaduranga authored May 29, 2024
2 parents 5aef3de + b1168ae commit 9bfe72e
Showing 1 changed file with 24 additions and 10 deletions.
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

0 comments on commit 9bfe72e

Please sign in to comment.