eos: groovy script to select some part of inbound xml and keep in property variable , later it will be used, stock balance interface

 

-----------------------------

import com.sap.gateway.ip.core.customdev.util.Message import groovy.util.XmlParser def Message processData(Message message) { // Retrieve the message body as a String def body = message.getBody(java.lang.String) as String // Define the starting and ending tags def startTag = '<stockBalance>' def endTag = '<items>' // Find the index of the start tag def startIndex = body.indexOf(startTag) // Find the index of the end tag and include it in the substring def endIndex = body.indexOf(endTag) + endTag.length() // Check if both start and end indexes were found if (startIndex != -1 && endIndex != -1) { // Extract the substring def resultSubstring = body.substring(startIndex, endIndex) // Set the extracted substring into a property (pro1) message.setProperty("pro1", resultSubstring) } return message }

---------------------------------


Popular posts from this blog

pss book : శ్రీకృష్ణుడు దేవుడా, భగవంతుడా completed , second review needed. 26th April 2024

pss book: గురు ప్రార్థనామంజరి . completed 21st july 2024

pss book: కధల జ్ఞానము read review pending. 25th june 2024