Need help to send a XML file to a Endpoint

Describe the problem/error/question

Hello, I’m trying to build a workflow that generates a token, registers a key, and then uses the returned information to send an HTTP request with an XML file. This process works perfectly in Postman, where I can select and attach the file. However the problem is, I’m having trouble sending the XML file with the HTTP request in N8N. I obtained some JavaScript code from someone that makes the request directly, but I haven’t been able to incorporate the XML file into it. Additionally, I don’t have access to their workflow, which is likely different from mine. In my system, I save the XML in Base64 format, then convert that string back to XML before sending the request (or whatever conversion is necessary since the system only accepts XML due to invoicing requirements).

PS: The last node is just to check that the file has been sent, if it has been accepted (XML) and processed, you can ignore it.

What is the error message (if any)?

First Error: Cannot read properties of undefined (reading '#>Object> ')
Second Error: I tried sending the Base64 directly but don’t work, needs to be a XML.

Please share your workflow

Share the output returned by the last node


Information on your n8n setup

  • n8n version: Version 1.61.0
  • Database (default: SQLite): Default.
  • n8n EXECUTIONS_PROCESS setting (default: own, main): Default.
  • Running n8n via (Docker, npm, n8n cloud, desktop app): Local Server.
  • Operating system: Windows.

Hi @FMagal,

why are you using the Code node to make the HTTP request? For sending a file in the payload, you can use this approach:

I tried that too… placing the file on the name and binary file on the file but didn’t work.
The JS XML was done by another guy who was implementing this system and it worked, but I don’t have access to its workflow or the guy’s contact details.

Could you please attach any information, such as screenshots of the error you’re encountering with this approach? I’m unable to replicate the attached workflow on my end.

1 Like

Based on your first error it looks like you are either using an expression or json path that doesn’t exist in the data. the node before JS XML are you getting the output correctly? I am guessing you might have an incorrect key to the base64 data you are trying to parse.
For your second error I think in your JS XML node if you are able to convert the base64 to raw XML it should get resolved.

1 Like

The first one i was trying to get the Binary Data and sending to the Step 2 (inside the JS XML), but i tried sending the Base64 string too and didn’t work.
The second one i made the Payload with the Base64 in the Body but needs to be a XML file… soo i run out of ideas, any tips for the “raw xml” you said?

@mohamed3nan i literally made a little dumb node and worked :melting_face:


Just made a Code to reply the Base64 to covert into Binary File going to the JS XML.

3 Likes

I’m pretty sure you can use the HTTP node instead of the Code node ‘JS XML’ as well, but they said, if it works, don’t touch it :sweat_smile::joy:

1 Like

Yeah haha, i didn’t tried with the Binary File node before, i’ll make a backup and try this new way.

1 Like

@mohamed3nan don’t work, tried everything :frowning:

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.