Web Service WCF output XML

0

I'm building a web service using WCF. I created the edmx file, I made the connection to the database where I am informing the tables, views and procedures that I want to use and my .svc file looks like this:

' This method is called only once to initialize service-wide policies.
Public Shared Sub InitializeService(ByVal config As DataServiceConfiguration)
    ' TODO: set rules to indicate which entity sets and service operations are visible, updatable, etc.
    ' Examples:
    config.SetEntitySetAccessRule("*", EntitySetRights.All)
    ' config.SetServiceOperationAccessRule("MyServiceOperation", ServiceOperationRights.All)
    config.DataServiceBehavior.MaxProtocolVersion = DataServiceProtocolVersion.V3

When I run the application it appears in xml the entities that I have.

<service xmlns="http://www.w3.org/2007/app" xmlns:atom="http://www.w3.org/2005/Atom"          xml:base="http://localhost:25415/WcfBarramentoDS.svc/">
<workspace>
<atom:title>Default</atom:title>
<collection href="Produtos">
<atom:title>Produtos</atom:title>
</collection>
<collection href="Ocorrencias">
<atom:title>Ocorrencias</atom:title>
</collection>
<collection href="Colaboradores">
<atom:title>Colaboradores</atom:title>
</collection>
<collection href="Despesas">
<atom:title>Despesas</atom:title>
</collection>
</workspace>
</service>

However, when choosing one such as '.svc / Products' my return is not XML.

<?xml version="1.0" encoding="utf-8"?><feed xml:base="http://localhost:25415/Nome.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/Nome.svc/ProdutosTI</id><title type="text">Produtos</title><updated>2015-11-09T10:40:57Z</updated><link rel="self" title="ProdutosTI" href="ProdutosTI" /><entry><id>http://localhost/Nome.svc/Produtos(Codigo='01000123',Produto='nomedoproduto')</id><category term="Model.Produtos" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" /><link rel="edit" title="Produtos" href="Produtos(Codigo='01000123',Produto='nomedoproduto')" /><title /><updated>2015-11-09T10:40:57Z</updated><author><name /></author><content type="application/xml"><m:properties><d:Codigo>01000123</d:Codigo><d:Produto>NomedoProduto</d:Produto></m:properties></content></entry>

What do I need to change to get XML output? And in the case I only get the return of the table in my entity. How do I return the result of a view or procedure in XML?

    
asked by anonymous 09.11.2015 / 11:47

1 answer

0

Hello,

The format shown in your example is 'ATOM': https://msdn.microsoft.com/en-us/library/dd541106.aspx

In this other link you have everything about odata, version 2, 3 and 4 link

Luiz

    
10.11.2015 / 15:53