cancel
Showing results for 
Search instead for 
Did you mean: 

SCPI Groovy Script to Read Header Parameters

MahanteshPatil
Discoverer
0 Kudos
Team,

I am writing Grrovy script in iFlow. I want to know how I can read Message Header * Properties in script & update values.

Thank you in advance,

Mahantesh

Accepted Solutions (1)

Accepted Solutions (1)

Sriprasadsbhat
Active Contributor

Hello Mahantesh,

Please find the below.

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

def Message processData(Message message) {

	//Body 
	def body = message.getBody();
	message.setBody(body + "Body is modified");
	
	//Get Headers 
	def map = message.getHeaders();
	def value = map.get("oldHeader");
	//Set Headers
	message.setHeader("oldHeader", value + "modified");
	message.setHeader("newHeader", "newHeader");
	
	//Get Properties  
	map = message.getProperties();
	value = map.get("oldProperty");
	//Set Properties 
	message.setProperty("oldProperty", value + "modified");
	message.setProperty("newProperty", "newProperty");
	
	return message;
}

Regards,

Sriprasad Shivaram Bhat

Answers (0)