Skip to Content

Combine Single Values and replace the values in Incoming Message

Hello Experts,

I have a scenario where i need to replace string Value from different branches in the main message.

Branch 1: Single Value :

MIAGCSqGSIb3DQEHAqCAMIACAQExDzANBglghkgBZQMEAgEFADCABgkqhkiG9w0B BwGggCSABEpDWjcyMDgwMDQzfDE4MXwwMC8yNTM1L0NONTh8MC8yNDgyL0lFMjV8 MjAxNi0xMi0wN1QyMjowMTowMCswMTowMHw4Nzk4OC4wMAAAAAAAADGCAr0wggK5

Branch 2: Single Value:

MSBQbGF5Z3JvdW5kAgR0c5cnMA0GCWCGSAFlAwQC

Branch 3: Main Message

http://schemas.xmlsoap.org/soap/envelope/">

<Header></Header>

<Data>

<urceno_cerp_zuct>343.00</urceno_cerp_zuct>

<cerp_zuct>237.00</cerp_zuct>

<rezim>1</rezim>

<pkp>CZ72080043|181|00/2535/CN58|0/2482/IE25|2016-12-07T22:01:00+01:00|87988.00</pkp>

<bkp>XXXXX|181|00/2535/CN58|0/2482/IE25|2016-127T22:01:00+01:00|87988.00</bkp>

</Data>

</ns0:EETRequest>

I need to replace the String Values with node <pkp> and <bkp> in the main message payload.

Can anybody please advice how it can be done.

Regards,

Rajesh

image1.jpg (33.5 kB)
Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Best Answer
    Jan 23 at 08:19 AM

    Hi,

    You can store single values from branch 1 & 2 in property/header of a content modifier. And then create branch 3 message body using that property/header inside a second content modifier.

    capture.jpg

    <pkp>${header.string1}</pkp>

    Thanks,

    Ashish

    Add comment
    10|10000 characters needed characters exceeded

  • Jan 30 at 11:29 AM

    Another more complex solution, if the other one doesn't work:

    With the incoming data - You could store one value in a message header, one value in a message exchange property and one value in the body to keep them separate. To replace the string values you could use a Groovy Script and manipulate the properties using the tags:

    def message_body = message.getBody();

    def message_headers= message.getHeaders();

    branch1Val = flow_headers.get("branch1Val");

    def message_properties = message.getProperties();

    branch2Val = flow_properties.get("exprop2");

    Then combine them within the script as you please. Using a substring function to find and replace the text between <pkp> </pkp> , and <bkp> </bkp>

    Add comment
    10|10000 characters needed characters exceeded