Odata controller

90 Views Asked by At

I have created a Test OdataController which returns the response in the atom format as given below,I want to use this as Odata Feed in Excel but I get an error as 406 Not Acceptable. What is wrong in the xml? and How to debug in Excel for this Any Odata Issue?

    <?xml version="1.0" encoding="UTF-8"?>
        <feed xmlns="http://www.w3.org/2005/Atom" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata">
            <id>TGlhcQ9wRbfCAp_Test_Profit</id>
            <updated>2017-10-30T11:26:52Z</updated>
            <title type="text">Test_Profit</title>
            <entry>
                <id>akGEyOBdfmwPgM_Test_Profit</id>
                <category scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" term="ccc.Test_Profit"/>
                <link href="BLRXQzxG6Lj2Pm" rel="edit" title="Test_Profit"/>
                <title/>
                <updated>2017-10-30T11:26:52Z</updated>
                <author>
                    <name/>
                </author>
                <content type="application/xml">
                    <m:properties>
                        <d:City>Houston</d:City>
                        <d:Profit m:type="Edm.Decimal">456407476.9582217200</d:Profit>
                    </m:properties>
                </content>
            </entry>
        </feed>
1

There are 1 best solutions below

0
On

According to Wikipedia,

406 Not Acceptable The requested resource is capable of generating only content not acceptable according to the Accept headers sent in the request.[39]

This doesn't mean there is anything wrong with the body of your request. When the server want to return something to you, while this "something" doesn't meet the "Accept" criteria in your request header, the server will return this response code to you. i.e. When the server wants to return a json response while you specify Accept : application/xml in your request head.