Sending notifications with attachments using an external system and the documents arrive corrupted
Hello,
We are trying to integrate with a client's external system to send notifications and, when we send documents attached to the notification, they arrive corrupted.
As I mentioned, to send the notifications we need to call an external system and the request body has 3 parameters. One of them must be in base64, which originally is an XML that contains the notification information (body, recipients, attachments, etc.).
The XML code is the follow one:
concat(
"",
"",
"",
/*(Opcional) Indicar si se debe realizar la comunicación solamente por una vÃ%ADa de envÃ%ADo: SMS, EMAIL, PUSH sin contingencias*/
"EMAIL",
" ",
"",
ri!codigoPeticion,
" ",
/*Destinatarios*/
joinarray(
a!forEach(
items: ri!arrayDestinatarios,
expression: char(10) & "" & fv!item & " "
),
""
),
" ",
ri!asunto,
" ",
toHtml(ri!cuerpo),
" ",
if(
a!isNullOrEmpty(ri!adjuntos),
null,
concat(
"",
a!forEach(
items: ri!adjuntos,
expression: concat(
"",
fv!item,
" "
)
),
" "
)
),
" ",
" "
)
At first, to generate the body of the request I used the "encodebase64string" function (plugin), as can be seen in the following code fragment, but this function corrupts the file.
{
source: cons!ARQ_GNM_VALOR_SOURCE_APP,
destination: cons!ARQ_GNM_VALOR_DESTINATION_APP,
notificationData:
encodebase64string(
concat(
"",
"",
"",
/*(Opcional) Indicar si se debe realizar la comunicación solamente por una vÃ%ADa de envÃ%ADo: SMS, EMAIL, PUSH sin contingencias*/
"EMAIL",
" ",
"",
ri!codigoPeticion,
" ",
/*Destinatarios*/
joinarray(
a!forEach(
items: ri!arrayDestinatarios,
expression: char(10) & "" & fv!item & " "
),
""
),
" ",
ri!asunto,
" ",
toHtml(ri!cuerpo),
" ",
if(
a!isNullOrEmpty(ri!adjuntos),
null,
concat(
"",
a!forEach(
items: ri!adjuntos,
expression: concat(
"",
fv!item,
" "
)
),
" "
)
),
" ",
" "
)
)
}
Then I tried to generate the XML as a document and pass it as a rule input. The code to generate the XML is the same.

This last solution also continues sending the corrupt attachment. Because when generating the XML text and then passing it to a document, the attachment is corrupted.
I can't think of any other solution to try. Could you help me?
Thanks.
