Skip to Content
0

SCPI Groovy Script to Read Header Parameters

Apr 24 at 01:35 PM

73

avatar image
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

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

1 Answer

Best Answer
Sriprasad Shivaram Bhat
Apr 24 at 01:41 PM
1

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

Share
10 |10000 characters needed characters left characters exceeded