Get file content from a blob gets an octet-stream. When I try to use that "File Content" later in the flow, it comes out as the original XML text (readable) which is breaking my HTTP request

Richard Wilkinson 1 Reputation point
2021-10-25T18:15:22.69+00:00

I have a Logic App that monitors a blob storage container for an XML to show up, then I do a "Get Blob Content using Path" to grab the XML content. I then use that content later in the flow to send in an HTTP request (to an Azure Function that then zips it up and returns the zip file as an output). When I run the flow, I see the output of the Get Blob Content as:
{
"$content-type": "application/octet-stream",
"$content": "77u/PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4NCjxEb2N1bWVuxxxx=="
}

I then use that output in my HTTP POST action, and I now see the readable XML instead. I'm pretty sure its failing because of the content type being sent.
{
"$content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<Document>\r\n\t<VENDINVOICEJOURNALHEADERENTITY JOURNALBATCHNUMBER=\"123456789\" DESCRIPTION=\"AP Invoice\"XXXXXXX",
"$content-type": "application/octet-stream"
}

I have tried changing the "$content-type" to application/xml, text/xml and nothing works. Funny thing though, I have this working with no issues in the Power Automate "FLOW" portal. The main difference is that the HTTP content I am sending in the body is an octet-stream! Is there an easy way to force that?

143477-image.png143517-image.png

Azure Logic Apps
Azure Logic Apps
An Azure service that automates the access and use of data across clouds without writing code.
2,854 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. MayankBargali-MSFT 68,656 Reputation points
    2021-10-29T05:14:12.573+00:00

    @Richard Wilkinson I have used the below logic app and I couldn't observe the issue at my end. I am only assigning the File Content object to the Body parameter of my HTTP action. You don't have to initialize the variable and assign the File Content. You can directly use it in your HTTP action as I have used in my below workflow.

    Logic App Workfow:
    144822-image.png

    The output of HTTP action is the same as below when I have selected Infer content type as Yes or No. The only changes will be to the Get Blob Content V2 action output i.e one will have the actual XML string as output (when you select Yes) while the other has $content-type and $content parameter (when you select No) in the output of Get Blob Content V2 action.

    144785-image.png

    Output at Function app end:
    144808-image.png

    Hope the above helps you to resolve the issue. Feel free to get back to me if you need any assistance.

    0 comments No comments