WSO2 ESB Script Mediator (Remove body of an soap envelop)
When you are implementing synapse configurations in WSO2 ESB (4.6.0), sometimes you might want to remove soap body. This happens to me when I was developing complex synapse configuration, which had lot of service chaining. The last of the service chaining was to call to a rest (GET) end point using rest api. Up to final call to rest api, everything seems to work perfect. But the last rest api call fails due to a soap envelop generated from service chaining. Simple solution was to remove the soap body from the envelop. then it worked perfectly as I expected.
This is the simple solution I used to remove the body from the soap envelop using script mediator.
<script language="js">
mc.getEnvelope().getBody().getFirstElement().detach();
print(mc.getEnvelope().getBody());
</script>
This is the simple solution I used to remove the body from the soap envelop using script mediator.
<script language="js">
mc.getEnvelope().getBody().getFirstElement().detach();
print(mc.getEnvelope().getBody());
</script>
Useful tip :)
ReplyDelete