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

Avoid cloning the message envelope when iterating #2105

Merged
merged 1 commit into from
Nov 3, 2023
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 @@ -23,9 +23,12 @@
import com.google.gson.JsonElement;
import com.google.gson.JsonParser;
import com.jayway.jsonpath.JsonPath;
import org.apache.axiom.om.OMAbstractFactory;
import org.apache.axiom.om.OMElement;
import org.apache.axiom.om.OMNode;
import org.apache.axiom.soap.SOAP11Constants;
import org.apache.axiom.soap.SOAPEnvelope;
import org.apache.axiom.soap.SOAPFactory;
import org.apache.axis2.AxisFault;
import org.apache.axis2.Constants;
import org.apache.axis2.context.OperationContext;
Expand Down Expand Up @@ -372,10 +375,17 @@ private MessageContext getIteratedMessage(MessageContext synCtx, int msgNumber,
throws AxisFault, JaxenException {

// clone the message for the mediation in iteration
MessageContext newCtx = MessageHelper.cloneMessageContext(synCtx);

//Remove the original jsonstream from the context
JsonUtil.removeJsonPayload(((Axis2MessageContext) newCtx).getAxis2MessageContext());
MessageContext newCtx = MessageHelper.cloneMessageContext(synCtx, false, false);
// Adding an empty envelope since JsonUtil.getNewJsonPayload requires an envelope
SOAPFactory fac;
if (SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI
.equals(synCtx.getEnvelope().getBody().getNamespace().getNamespaceURI())) {
fac = OMAbstractFactory.getSOAP11Factory();
} else {
fac = OMAbstractFactory.getSOAP12Factory();
}
SOAPEnvelope newEnvelope = fac.getDefaultEnvelope();
newCtx.setEnvelope(newEnvelope);

if (id != null) {
// set the parent correlation details to the cloned MC -
Expand Down
Loading