cancel
Showing results for 
Search instead for 
Did you mean: 
Subscribe

Hi Experts,

I want to store an XPath in the property using a content modifier for the attached Payload.

I tried the below, but the response looked weird as below.

So, I have changed the Data Type to java.lang.Object . Now, I am able to capture the data in the property.

Not sure, If I am overlooking or missing something.

Any leads/solutions will be really helpful.

Regards,

Pavan

0 Likes
View Entire Topic
babruvahana
Contributor

Hi mnw,

Thanks for the response.

I would like to store 2 XPaths for now (maybe more in the future) and pass them to the next steps for further processing which involves mapping where the mapping considers one of these properties as input.

Tried to store the data as properties using the below Groovy as well. But, no luck yet.

import com.sap.gateway.ip.core.customdev.util.Message;
import java.util.HashMap;
import java.util.*;

def Message processData(Message message) {
       def xml = message.getBody(String.class)
       def completeXml= new XmlSlurper().parseText(xml)
       
       def sd = completeXml.RetryPayload.'**'.findAll { node-> node.name() == 'SourceData'}*.text()
       def td = completeXml.RetryPayload.'**'.findAll { node-> node.name() == 'TransformedData'}*.text()
       
       message.setProperty("SourceData", sd)
       message.setProperty("TransformedData", td)

       return message
}<br>

Regards,

Pavan