Search code examples
pythonxmledi

How to send .xml file with correct name using as2?


I have a partner with whom we exchange .edi messages using the as2 protocol.

Now we need to switch to messaging in the .xml format. Moreover, my partner wants the files to have the correct names.

I use my own library (based on pyas2lib). Judging by the information I found on the internet, I need to change the message headers. I changed "Content-Disposition" to "attachment; filename=my_file.xml ", added the parameter "name" = my_file.xml, changed the type to "application/xml". But all to no avail - the file content is displayed correctly, but its name looks like a random set of characters.

Is there any way I can send a file with the correct name? If so, how do I do it? Should the partner specify any settings for themselves?

I will be glad of any help on this issue and will try to answer any questions that arise.


Solution

  • As it often happens, it turned out to be my inattention. The name of the file being transferred and the type of content are controlled by the build() method of the Message class in pyas2lib.

    Before that, I passed these values after building the message, which led to incorrect operation.