C# wcf数据服务将响应格式化为xml

C# wcf数据服务将响应格式化为xml,c#,xml,wcf,C#,Xml,Wcf,我创建了一个像这样的wcf数据服务 public class Northwind : DataService< SelfServiceEntities > { // This method is called only once to initialize service-wide policies. public static void InitializeService(DataServiceConfiguration config)

我创建了一个像这样的wcf数据服务

public class Northwind : DataService< SelfServiceEntities >
    {
        // This method is called only once to initialize service-wide policies.
        public static void InitializeService(DataServiceConfiguration config)
        {
            config.SetEntitySetAccessRule("SMS", EntitySetRights.AllRead
                | EntitySetRights.WriteMerge
                | EntitySetRights.WriteReplace);
        }
    }
我得到了这样的回应

<?xml version="1.0" encoding="utf-8"?><feed xml:base="http://localhost:2242/Northwind.svc/" 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>http://localhost:2242/Northwind.svc/SMS</id><title type="text">SMS</title><updated>2014-02-05T08:33:49Z</updated><link rel="self" title="SMS" href="SMS" /><entry><id>http://localhost:2242/Northwind.svc/SMS(1)</id><category term="SelfServiceModel.SM" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" /><link rel="edit" title="SM" href="SMS(1)" /><title /><updated>2014-02-05T08:33:49Z</updated><author><name /></author><content type="application/xml"><m:properties><d:ID m:type="Edm.Int32">1</d:ID><d:number>1</d:number><d:body_ar>1</d:body_ar><d:body_en>1</d:body_en></m:properties></content></entry><entry><id>http://localhost:2242/Northwind.svc/SMS(2)</id><category term="SelfServiceModel.SM" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" /><link rel="edit" title="SM" href="SMS(2)" /><title /><updated>2014-02-05T08:33:49Z</updated><author><name /></author><content type="application/xml"><m:properties><d:ID m:type="Edm.Int32">2</d:ID><d:number>55</d:number><d:body_ar>55</d:body_ar><d:body_en>55</d:body_en></m:properties></content></entry></feed>
OData定义了一组对Atom发布协议(AtomPublishing Protocol,AtomPub)的扩展。它支持多种数据格式的HTTP请求和响应,以适应各种客户端应用程序和平台。OData提要可以用Atom、JavaScript对象表示法(JSON)和普通XML表示数据虽然Atom是默认格式,但提要的格式在HTTP请求的头中指定。有关更多信息,请参见OData:Atom格式和OData:JSON格式


对我来说,这看起来像xml?@StuartLC浏览器没有将其读取为xml。当我在java上使用REST时。我可以生成可以被浏览器读取为xml的响应。我指的是节点和协作。你抓到我了吗?
<?xml version="1.0" encoding="utf-8"?><feed xml:base="http://localhost:2242/Northwind.svc/" 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>http://localhost:2242/Northwind.svc/SMS</id><title type="text">SMS</title><updated>2014-02-05T08:33:49Z</updated><link rel="self" title="SMS" href="SMS" /><entry><id>http://localhost:2242/Northwind.svc/SMS(1)</id><category term="SelfServiceModel.SM" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" /><link rel="edit" title="SM" href="SMS(1)" /><title /><updated>2014-02-05T08:33:49Z</updated><author><name /></author><content type="application/xml"><m:properties><d:ID m:type="Edm.Int32">1</d:ID><d:number>1</d:number><d:body_ar>1</d:body_ar><d:body_en>1</d:body_en></m:properties></content></entry><entry><id>http://localhost:2242/Northwind.svc/SMS(2)</id><category term="SelfServiceModel.SM" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" /><link rel="edit" title="SM" href="SMS(2)" /><title /><updated>2014-02-05T08:33:49Z</updated><author><name /></author><content type="application/xml"><m:properties><d:ID m:type="Edm.Int32">2</d:ID><d:number>55</d:number><d:body_ar>55</d:body_ar><d:body_en>55</d:body_en></m:properties></content></entry></feed>
OData builds on standard Internet protocols to make data services interoperable with applications that do not use the .NET Framework. Because you can use standard URIs to address data, your application can access and change data by using the semantics of representational state transfer (REST), specifically the standard HTTP verbs of GET, PUT, POST, and DELETE. This enables you to access these services from any client that can parse and access data that is transmitted over standard HTTP protocols.