.Net & WCF - How to create REST instead of SOAP?

I created a couple of services, but they all work like soap web services and return soap messages.

1- How can I make my wcf project more relaxed than soap?

2 How can I make all services return and expect json instead of xml?

+3
source share
3 answers

You need to do at least two things:

  • decorate your work contracts (service methods) with the attribute WebGetor WebInvokeand define a URI pattern

  • Define a service endpoint that uses webHttpBindingspecific endpoint behaviorwebHttp

Other than that, you really don't need to do anything to start the REST service.

: "" SOAP REST - "" REST. , RESTful.

SOAP - , GetCustomer, GetBalance ..

REST, , - Customer, HTTP GET URI , PUT , POST , DELETE ( HTTP-) . , REST - , .

+5

WCF REST/Json " - WCF JSON".

+1

MSDN , , " JSON" WCF. .

, - WCF, , JSON-/AJAX- WCF, .

, !

+1

Source: https://habr.com/ru/post/1791781/


All Articles