3 weeks ago - last edited 3 weeks ago
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 |
---|---|
70 | |
11 | |
10 | |
10 | |
9 | |
9 | |
6 | |
6 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.