Answered by:
Connect to web service oData feed with Power Query

Question
-
Hi,
after the last update of Machine Learning Studio, I can't connect to the web service through oData feed.
I imported the OData with "Other Sources" , from OData Feed, with anonymous access.
When I try to use the Score function with parameters, I get this error:
DataSource.Error: OData: Richiesta non riuscita: Errore del server remoto: (406) Non accettabile. (Not Acceptable)
Am I doing something wrong?
Thanks
Giovanni
Friday, February 13, 2015 2:56 PM
Answers
-
Hi Giovanni,
Can you please submit another scoring request to the service and share with me the exact time frame you did that and then the request id returned as a header in the response? I can then look up the request in out server logs and see why you are getting the 401 on single request scoring.
Thanks,
|Tudor- Proposed as answer by Pavel Dournov - MSFT Monday, March 2, 2015 1:17 AM
- Marked as answer by neerajkh_MSFT Wednesday, March 4, 2015 4:44 PM
Tuesday, February 24, 2015 4:57 PM
All replies
-
Hi Giovanni,
We have a known issue right now where all errors when invoking a web service via OData surface as 406 errors. Are you able to successfully call the regular REST endpoint for this service with the same payload?
Ritwik
Friday, February 13, 2015 5:34 PM -
HI Giovanni,
you can only see what's on the odata endpoint with anonymous access, but to call scoring function you need to enter your key.
So instead of anonymous, can you choose basic auth, give it any string for username(or just leave it blank if allowed), and put in your endpoint API Key as password. Can you give this a try?
Friday, February 13, 2015 6:19 PM -
Hi Ritwik,
I tried to call the "OData End Point Address" from browser and it returned an xml.
If I try to use this address in Power Query, I get the feed in my right-list, but when I try to use the Score function, I get the 406 error.
If I use this request address in browser I get 406 error.
Which other test could I do (i did not catch your advice, sorry)?
Thanks,
Giovanni
Tuesday, February 17, 2015 11:00 AM -
Hi Michael,
I tried with basic authentication as you said, but I get 406 error yet.
Thanks
Giovanni
Tuesday, February 17, 2015 11:04 AM -
Hi Ritwik,
I tried to use a python script to test the regular REST endpoint:
import urllib2 import json data = { "Inputs": { "input1": { "ColumnNames": ["IndexSMP", "Des_LineaProdotto", "Des_LineaCommerciale", "Des_Rgt_LineaProdotto", "Des_TipologiaProdotto", "Des_Designer", "des_GruppoPF"], "Values": [ [ "0", "value", "value", "value", "value", "value", "value" ], [ "0", "value", "value", "value", "value", "value", "value" ], ] }, }, "GlobalParameters": { } } body = str.encode(json.dumps(data)) url = 'https://ussouthcentral.services.azureml.net/workspaces/728fb8381e964686b33402d2aed7c7ca/services/3889cc778a564a4fb9b707b07ee0a613/execute?api-version=2.0&details=true' api_key = 'I put here my API key :)' # Replace this with the API key for the web service headers = {'Content-Type':'application/json', 'Authorization':('Bearer '+ api_key)} req = urllib2.Request(url, body, headers) response = urllib2.urlopen(req) result = response.read() print(result)
I got this:
raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)
urllib2.HTTPError: HTTP Error 401: UnauthorizedCould it help?
Thanks a lot! Bye
Giovanni
Wednesday, February 18, 2015 5:12 PM -
No ideas? :)Monday, February 23, 2015 4:23 PM
-
Hi Giovanni,
Can you please share a failing request Id and time frame for it so we can take a look at this in the service logs?
Thanks,
|TudorMonday, February 23, 2015 10:12 PM -
Hi Tudor,
sorry but I don't know how to do what you are asking me. Could you help me?
Thanks,
Giovanni
Tuesday, February 24, 2015 4:20 PM -
Hi Giovanni,
Can you please submit another scoring request to the service and share with me the exact time frame you did that and then the request id returned as a header in the response? I can then look up the request in out server logs and see why you are getting the 401 on single request scoring.
Thanks,
|Tudor- Proposed as answer by Pavel Dournov - MSFT Monday, March 2, 2015 1:17 AM
- Marked as answer by neerajkh_MSFT Wednesday, March 4, 2015 4:44 PM
Tuesday, February 24, 2015 4:57 PM