Forum Discussion
Get data from webservice
I am trying to bring data into my dashboard by accessing a websevice endpoint. It works fine in my mobile report wher i am using a dataset based on an xml data source. After proving URL of that data source I get the following screen:
After Loading it I dont see any data.
Any idea?
Thanks
20 Replies
- v-qiuyu-msftCommunity Support
Hi Markzolotoy,
In Power BI, the Web data source type is used for importing a table of data from a Web page. You can take a look at this article: Tutorial: Importing and analyzing data from a Web Page using Power BI Desktop.
In your scenario, as the web page doesn't contain any table data, you only retrieve element data in Query Editor. I would suggest you use XML data source instead of Web URL to retrieve data.
Best Regards,
Qiuyun Yu- MarkzolotoyImpactful Individual
When I choose XML as a data source it prompts me to seldect a file, but I want to get it from the webservice.
- v-qiuyu-msftCommunity Support
Hi Markzolotoy,
You can see when you use web data source to get data, you just need to place the URL and extract records from the dataset. But in your scenario, the extracted records don't contain any fact data. So it's not a good option to use web data source if you want to get fact data.
Best Regards,
Qiuyun Yu
- suvariesFrequent Visitor
Did you click on the 'Table'?
- MarkzolotoyImpactful Individual
Ok, first I get this:
After Edit I get this:
Then I click on Table and get this:
Then I click on Table again and get this:
At this point nothing to click on.
Any more ideas?
- YoussefMicrosoft Employee
You should be able to connect to Restful Web Services that return valid Json using the GetData from Web in Power BI Desktop.
From the screenshot, it seems that what returns from the URL you put is not Json but HTML. You can monitor the traffic with Fiddler and make sure what's coming back is actual json.
Hope this helps.
- MarkzolotoyImpactful Individual
Do I need to change my data source after it's been created to say Json? By default it says HTML.
But the reason I am not gettng json id because my webservice is not returning pure json?
- YoussefMicrosoft Employee
What is the data type you are expecting from your webservice end point? Is it Json? If so, they Power BI should perfectly support this scenario. Let me know if that's the case and you are still facing issues.
If the data you are expecting is HTML data like a web page, you can refer to the articly linked in one of the replies above on more details on that. You might have to do some parsing and cleaning up in this case.
- karekaasamoenFrequent Visitor
I'm relatively new to PowerBI and powerQuery, and maybe you have had this problem sorted out allready, but it seems like you have drawn data from an url without formatting it as xml data. I guess you have use a formula like:
Source = Web.Contents(https://some.url.here)
Which by default will return a HTML file. Try to wrap the web-connector in an XML formula like this:
Source = Xml.Tables(Web.Contents(https://some.url.here))
And I guess you will be fine
- karekaasamoenFrequent Visitor
I'm relatively new to PowerBI and powerQuery, and maybe you have had this problem sorted out allready, but it seems like you have drawn data from an url without formatting it as xml data. I guess you have use a formula like:
Source = Web.Contents(https://some.url.here)
Which by default will return a HTML file. Try to wrap the web-connector in an XML formula like this:
Source = Xml.Tables(Web.Contents(https://some.url.here))
And I guess you will be fine
- MarkzolotoyImpactful Individual
Where exactly do I place that formula?
- karekaasamoenFrequent Visitor
The best way is to use the advanced query editor. From the analysis-model (main window), click the Edit Queries button
Then, right-click the actual datasource and select advanced editor
I guess the source of your data looks quite similar to this Source = ( Web.Page(Web.Contents(....)
Change this to Xml.Tables(Web.Contents and I guess you will have your data as expected. The advanced editor uses PowerQuery scripting language, is flexible and gives a lot of opportunities, but if you haven't used this you have a certain learning curve. But try it out