Logic Apps standard — XML transformation issue
Recently there was a requirement to transform a positional flat file to XML format. In Logic Apps there are few options to achieve this. Below articles can help getting started and achieving the same.
Issue:
When xml result is generated and sent to the target system, target system generated an error when processing the file.
Error:
XML marshalling error: Content is not allowed in prolog
XML message:
�<?xml version=\"1.0\" encoding=\"utf-8\"?>
<ns0:WorkOrder xmlns:ns0=\"http://xmlschema.ts/work/order\"> </ns0:WorkOrder>
There was a symbol � attached to the xml message when transforming the file using transform XML action in Logic App. This is the reason for the xml marshaling failure at the target system.
Solution:
After multiple failure attempts to find and replace this symbol with regex and other symbols, decided to look at what are the options available at Logic App transform XML action.
When Disabled the byte order mark is enabled at the transform options, it removed the special mark at the result xml output. This resolved the issue at the client application and it was able to process the resultant xml successfully.