cancel
Showing results for 
Search instead for 
Did you mean: 

Combine Single Values and replace the values in Incoming Message

0 Kudos

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

<ns0:EETRequest xmlns:ns0="XXX:XXXXpo:XX:XXXX" xmlns:SOAP="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

Accepted Solutions (1)

Accepted Solutions (1)

ashish_goel4
Active Participant
0 Kudos

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

0 Kudos

Hi Ashish,

Thanks for the sharing the info.

Answers (1)

Answers (1)

0 Kudos

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>