Replace the Message ([login to view URL]) content with altered soap xml. If any xml element of SOAP message in the "ref Message reply" paramte has a value of "0E-number" eg: 0E-7 then replace it with 0 and update the "ref Message reply" paramter, You should retain the same xml format. Just replace only those values if found.
See the attached code
/// <summary>
/// Allows adding in WS-Security header to incoming request
/// </summary>
public class TestMessageInspector : IClientMessageInspector
{
.......
public void AfterReceiveReply(ref Message reply, object correlationState)
{
// Here Need to replace or alter the reply Message ([login to view URL]) content with other soap xml. Tried the below code and it does not alter the reply message content
var sb = new StringBuilder("<testAmt>88977</testAmt>");
using (var sw = [login to view URL](new StringWriter(sb)))
{
[login to view URL](sw);
[login to view URL]();
} }
}
Sample Input:
<? xml version='1.0' encoding='utf-16'?><SOAP-ENV:Envelope xmlns:SOAP-ENV='[login to view URL]'><SOAP-ENV:Header/><SOAP-ENV:Body>< ns4:testResponse xmlns:ns2 = '[login to view URL]' xmlns:ns4 ='[login to view URL]'><Document><testAmt >0E-7</testAmt><testRate>0</testRate><test1Amt>0E-8</test1Amt></Document></ns4:testResponse></SOAP-ENV:Body></SOAP-ENV:Envelope>
Sample Output:
<? xml version='1.0' encoding='utf-16'?><SOAP-ENV:Envelope xmlns:SOAP-ENV='[login to view URL]'><SOAP-ENV:Header/><SOAP-ENV:Body>< ns4:testResponse xmlns:ns2 = '[login to view URL]' xmlns:ns4 ='[login to view URL]'><Document><testAmt >0</testAmt><testRate>0</testRate><test1Amt>0</test1Amt></Document></ns4:testResponse></SOAP-ENV:Body></SOAP-ENV:Envelope>
Please refer the comments in the code and ask me for any details
Getting the below output and format is automatically updated by .NET which is undesirable
<s:Envelope xmlns:s="[login to view URL]">
<s:Header>
<Action s:mustUnderstand="1" xmlns="[login to view URL]" />
</s:Header>
<s:Body>
<string xmlns="[login to view URL]"><? xml version='1.0' encoding='utf-16'?><SOAP-ENV:Envelope xmlns:SOAP-ENV='[login to view URL]'><SOAP-ENV:Header/><SOAP-ENV:Body>< ns4:testResponse xmlns:ns2 = '[login to view URL]' xmlns:ns4 ='[login to view URL]'><Document><testAmt >0E-7</testAmt><testRate>0</testRate><test1Amt>0E-8</test1Amt></Document></ns4:testResponse></SOAP-ENV:Body></SOAP-ENV:Envelope></string>
</s:Body>
</s:Envelope>