Search code examples
odata

OData: Incompatible type kinds were found. Found type kind 'Primitive' instead of the expected kind 'None'


I am trying to use Excel 16.0.11929.20436 Get Data from Other Sources : OData Feed. When I enter the url I get the below error. OData: Incompatible type kinds were found. Found type kind 'Primitive' instead of the expected kind 'None'.

I referred to the issue in github https://github.com/OData/odata.net/issues/1445 and it mentioned 'OData protocol does not allow duplicate names for top-level elements in the same namespace' Based on that solution, I fixed the duplicates in my CSDL but still get the same issue even without the duplicates. Below is the generated CSDL after the fix. When I type the url in the browser, data is loaded without any errors. Only when used in MS Excel it gives the error. Therefore I am pretty sure this has to be with some Excel OData functionality, but unfortunately there is no log that I can check what the issue is. Unfortunately Microsoft client support team has no positive response to give with regard this problem.

However CustomerInfo has a sub element that has name 'CustomerCategory' which referred to the CustomerCategory. But that is not a top level element.

  1. What could be the reason now to still get this same error? How can this be validated? the validation site http://validator.odata.org/ is also down.
  2. Is there a way to check the excel logs or debug the process?

Get data from OData feed in excel

Error message CSDL with no duplicate names


Solution

  • I figured out the solution for this issue. Posting this answer with the intention of helping some one who is having trouble.

    When you install fiddler it will not listen to requests from local host if your server is also in the same machine. Therefore do the following configurations to get it fixed.

    1. Fiddler -> Rules -> Customize Rules
    2. Add the below code inside the method code : OnBeforeRequest(oSession: Session)

      if (oSession.HostnameIs("machine_name")) { oSession.host = "127.0.0.1:8080"; }

      change the port to the port you have any other port for localhost server

    Now your requests to the local server will be listened by fiddler.

    If you send the requests via browsers, then those will be listened by default. If you use Microsoft Excel OData feed url to send the request : then you have to append '.fiddler' to the end of hostname.

    Example :

    i. http://localhost.fiddler:8080/contxt_root/ProjectionName.svc/EntitySetName?$format=json 
    ii. https://your_hose.fiddler:port/context_root/ProjectionName.svc/EntitySetName?$format=json
    

    Hope this helps with anyone struggling with debugging Microsoft OData feed urls with fiddler.