Forum Discussion
How to get data from a SOAP WS with Power BI
Good evening. I used your tips, and they really worked, the formatting was simpler. Thanks for the days. Regarding using the text.format, I really did not understand how to apply this. The idea is to receive this as a parameter? So you do not get stuck in the code? Thank you
Text.Format would help you to store username password in some parameter and pass it to the XML builder routine. Something like this:
Text.Format("longxml
<username>#[username]</username>
<password>#[password]</password>
more xml",[username = parameter_username, password= parameter_password])
- Pubudu9 years agoRegular Visitor
Can you please share your next SOAP request with dummy key. Just to check how should I construct. I was trying as bellow.
let
Source = Xml.Tables(Web.Contents("https://api1.xxx.com/services/MainService?wsdl"
,[Content=Text.ToBinary("<x:Envelope xmlns:x="&Character.FromNumber(34)&"http://schemas.xmlsoap.org/soap/envelope/"&Character.FromNumber(34)&" xmlns:ser="&Character.FromNumber(34)&"http://services"&Character.FromNumber(34)&">
<x:Header/><x:Body>
<ser:getHistory>
<ser:sessionId>xxxxxxxxxx</ser:sessionId>
<ser:entityTypeId>4</ser:entityTypeId>
<ser:startYYYYMMDD>2016/08/04 05:49:05</ser:startYYYYMMDD>
<ser:endYYYYMMDD>2016/08/17 07:33:46</ser:endYYYYMMDD>
<ser:showRepeatingPerDay>false</ser:showRepeatingPerDay>
<ser:simpleDateFormat>yyyy/MM/dd HH:mm:ss</ser:simpleDateFormat>
</ser:getHistory>
</x:Body>
</x:Envelope>"),Headers=[#"Accept-Encoding"="gzip,deflate", #"Content-Type"="text/xml;charset=UTF-8"]]))
in
Source
But this start giving following error.
DataSource.Error: Web.Contents failed to get contents from 'https://api1.innotas.com/services/MainService?wsdl' (500): Internal Server Error
Details:
DataSourceKind=Web
DataSourcePath=https://api1.innotas.com/services/MainService
Url=https://api1.innotas.com/services/MainService?wsdl
I was using Anonymous as credentials to get the session id which was working. Can u please guide me? - juliovidigal9 years ago
Advocate I
Thank you for the tip.
I will certainly use it in other scenarios. In this scenario, I only use username and password at that moment, then I use the Token that I get from this authentication, and that email and password will not change.Thank you
- juliovidigal9 years ago
Advocate I
Good morning, sorry for the delay.
Is this the first call, or do you want to use her return to populate the sessionId?
- rodolfo_sgl9 years agoFrequent Visitor
Ok,
this will probably solve my request problem:
let
Source = Xml.Tables(Web.Contents("https://myWSDL"
,[Content=File.Contents("PathToMyXmlfile.xml"),Headers=[#"Accept-Encoding"="gzip,deflate", SOAPAction="", #"Content-Type"="text/xml;charset=UTF-8"]]))
in
SourceBut the response is a json file. There's a way to parse it?
- juliovidigal9 years ago
Advocate I
In the visual layer of PowerBI, you have to give a parse ..
But if it is your case, I have a scenario that I call an API that returns a json file, and I treat it as follows ..
let
SourceTESTE = "http://mediamanager.voxus.tv/api/?method=detailed&token=XXXXXX&start_date=" & "20/11/2016" & "&end_date=" & "30/12/2050",
Fonte = Json.Document(Web.Contents(SourceTESTE ))......