Reputation: 31
I'm send ISO8583 message from testclient to my inbound,
i have the log console :
<?xml version='1.0' encoding='utf-8'?>
<soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope">
<soapenv:Body>
<ISOMessage xmlns="http://ws.apache.org/ns/synapse">
<data>
<field id="0">0200</field>
<field id="3">568893</field>
<field id="4">000000020000</field>
<field id="7">0110563280</field>
<field id="11">456893</field>
<field id="44">DFGHT</field>
<field id="105">ABCDEFGHIJ 1234567890</field>
</data>
</ISOMessage>
</soapenv:Body>
</soapenv:Envelope>
Response From Server :ISOMessage from pool-28-thread-1 is consumed :
0210B220000002100000000000000080000056892300000010050001105632804568930005KAMAL021ABCDEFGHIJ 1234567890
how to change response from server, for example i want to change field id 105 from <field id="105">ABCDEFGHIJ 1234567890</field>
to <field id="105">xxxxxxxxxx 000000000</field>
I don't know how to alter data and send it back to client. I search on wso2 documentation, how to respond message in inbound, but I can't find anything. how to handle incoming ISOMessage, alter it, and send it back to client? Do we need create connector or just simply modify data in sequence?
thanks
Upvotes: 0
Views: 178
Reputation: 91
You can simply modify the XML within the sequence. Once you received the message you can modify it using the Enrich Mediator as follows (You need to specify the proper XPath to identity the element to change).
Once the response is modified, you can use Send mediator to send it to a
<!-- todo: receive the message -->
<property name="newValue" value="xxxxxxxxxx 000000000"/>
<enrich>
<source type="property" clone="true" property="newValue"/>
<target xpath="$body/*[1]/*[1]/*[7]"/>
</enrich>
<log>
<property name="message" expression="$body"/>
</log>
<!-- todo: send the message -->
Upvotes: 0