2024 Sep 10 2:06 PM - edited 2024 Sep 10 2:07 PM
Hi,
We have a scenario where sender sends form-data as below to Cloud Integration.
However in Cloud Integration we only need to read the main content of the file(SampleCSV.txt) i.e. "1","2","3,a","4","5" and pass the same to target. Is there a standard way to achieve the same? Please advise
----------------------------705490356377119745888137
Content-Disposition: form-data; name="File"; filename="SampleCSV.txt"
Content-Type: text/plain
"1","2","3,a","4","5"
----------------------------705490356377119745888137--
Best Regards
Hi ,Can you please try this code
import com.sap.gateway.ip.core.customdev.util.Message
def Message processData(Message message) {
def body = message.getBody(String)
def boundary = body.split('\n')[0].trim()
def pattern = /(?s)${boundary}.*?Content-Type: text\/plain\s+(.*?)\s+${boundary}--/
def matcher = body =~ pattern
if (matcher.find()) {
def fileContent = matcher.group(1).trim()
message.setBody(fileContent)
}
return message
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
74 | |
10 | |
10 | |
7 | |
7 | |
7 | |
7 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.