0
votes

I'm trying to post the XML request (in the first XML body) to the https link in the picture below on Power BI (as a data source). The bottom XML body is what I should be getting back. I have seriously gone through the depths of google to find a solution, but I'm having a lot of trouble. Any help would be much appreciated. screenshot from Postman

Pic of Advanced Editor Query

Token Comma Expected Error

1
Can you post the code you have you tried in Power Query? I would think you would be able to do this with Web.Contents and specifying the Header and Contents parameters. - Wedge
I just updated the post to include a picture of my query in advanced editor. I think the issue is that I don't know how to format that XML request in the editor, but I cannot find anything specifically with XML format requests, only have found information for JSON requests. - Nicole P
@Wedge I gave your recommendation a go, but now there's a "token comma expected error" for the 'Source' (highlighted it yellow in the third picture I uploaded) - Nicole P
A comma sort of denotes the next "line" in PQ code, so it just wants a comma after content is defined (added that to the answer, sorry). - Wedge

1 Answers

1
votes

I can't test or help with specifics of how the XML request itself should properly be setup, but I believe to enter it into Web.Contents it would look something like this. I think the XML request should just be setup as a string and then you use Text.ToBinary in the Content field of Web.Contents.

content = "<?xml version=""1.0""?>
<Kronos_wfc version=""1.0"">
<Request Object=""System"" Action = ""Logon"" etc, etc ",

Source = Xml.Tables(Web.Contents("XmlService", [Headers=[#"content-type"="text/xml"], Content=Text.ToBinary(content)]))