Forum Discussion

jmtjmt's avatar
jmtjmt
New Contributor
5 years ago
Solved

Prevent Byte-Order Mark (BOM) from prepending attachments


Hello all, I am new to SoapUI and web services in general... So I am grateful for any advice you can offer in advance.

 

I am working on trying to emulate SOAP messages from a black box client in SoapUI so we can build a new version of the client ourselves.  I have many of the requests working just fine but one in particular is giving me trouble.  One of my requests requires an XML attachment, which seems easy enough to add in SoapUI... However the server responds with a "malformed attachment" response.

 

Upon examination with Wireshark, the SOAP message generated by SoapUI prepends a BOM (=EF=BB=BF) to the attachment.  This BOM does not appear on the SOAP messages generated by the actual client I am trying to emulate... Additionally, the byte "3D" seems to be inserted in the request wherever =" shows up in the XML... This seems to be some kind of encoding error, but after playing with all of the properties I can't seem to be able to send the attachment without it getting mangled.  Any advice would be truly appreciated.

  • Are you sure that SoapUI is adding it - it's not in the XML file you're attaching?

     

    You could try opening the XML file in something like Notepad++ or Visual Studio Code:

    • In Notepad++, choose "Encode in UTF-8 without BOM" from the Encoding menu, then save.
    • In Code, press Ctrl-Shift-P and type Change File Encoding. Then Save With Encoding, and choose UTF-8 (as opposed to UTF-8 with BOM).

2 Replies

  • JHunt's avatar
    JHunt
    Community Hero

    Are you sure that SoapUI is adding it - it's not in the XML file you're attaching?

     

    You could try opening the XML file in something like Notepad++ or Visual Studio Code:

    • In Notepad++, choose "Encode in UTF-8 without BOM" from the Encoding menu, then save.
    • In Code, press Ctrl-Shift-P and type Change File Encoding. Then Save With Encoding, and choose UTF-8 (as opposed to UTF-8 with BOM).
    • jmtjmt's avatar
      jmtjmt
      New Contributor

      Thank you so much for your input.  I followed your suggestion with Notepad++ and it worked like a charm.  Once the BOM was removed the requests went through normally!

       

      Thank you for taking the time to help me out!