Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the relationship between WCF, Rest and SOAP?

What is the relationship between WCF and REST&SOAP? Is WCF based on one of those technologies (REST or SOAP) or it is a separate technology?

like image 588
user1460819 Avatar asked Feb 28 '13 04:02

user1460819


People also ask

Is WCF same as SOAP?

Using service behavior classes, WCF supports multi-threading, but web services don't. 9. In ASP.NET Development services, SOAP messages are exchanged over HTTP, but WCF services can exchange the message using any format over any transport protocol. Though, SOAP is a default format that WCF uses.

Is WCF based on SOAP?

WCF services use SOAP by default, but the messages can be in any format, and conveyed by using any transport protocol like HTTP,HTTPs, WS- HTTP, TCP, Named Pipes, MSMQ, P2P(Point to Point) etc.

What is SOAP in WCF service?

SOAP stands for simple object access protocol. In WCF the main thing is that the communication between the server and client. The communication takes place by messages with some transport layer. The main need of calling a service is to do the data transfer between the server and client.

Is WCF SOAP API?

So, yes, WCF supports both . In context with OP: SOAP services: in WCF programming model support interoperability between systems that are built with Java, other platforms, and those that use messaging standards that are supported by Microsoft®.


2 Answers

WCF is a messaging framework for building distributed systems. Distributed systems is mostly just another word for web services.

What this means is that you can write methods in C# (or any of the .NET languages) and then apply a bunch of configurations to the code that make your code accessible to others and turn your code into a web service.

Those "bunch of configurations" are WCF. WCF allows you to expose your methods to other computers or applications using REST if you set up the WCF configurations around your C# code to expose it as a RESTful service. Or, you can easily take the same C# methods and make them available via the SOAP protocol.

If you have a method called "GetData()", you can set up the WCF configuration to make that method available in a service that is hosted in IIS. When someone calls that service, they can send an HTTP GET request to http://www.yourdomain.com/SomeService/GetData, and the GetData method will receive the message and send back a response. When you make a GET request over HTTP, you're using the REST. REST is pretty much tied to HTTP as the transport protocol. REST also has no standard message format. Whatever you want to send in your HTTP message, and however you want to send it is OK. You can send XML, or JSON, or just plain text. You can use POST, or GET or PUT or any of the HTTP verbs as well.

With SOAP, your messages can be sent to the service using any transport protocol -- you aren't tied to HTTP. SOAP messages are designed to be transport neutral. They are encoded in XML and the XML always has a head and a body node inside of an envelope node. There are lots of web standards around SOAP -- standards for putting security, sessions and other features into the header of the message, for example. Also, with SOAP, you get a WSDL, which I won't go into explaining here, but it makes it a LOT easier for clients to program against. Most programming languages have a method of taking a WSDL and converting it into strongly-typed methods and objects so that your service is easy to call.

REST is very popular on the internet and is as scalable as the internet (i.e. VERY scalable). SOAP is very popular in business-to-business applications.

like image 90
Trevor Avatar answered Oct 12 '22 10:10

Trevor


WCF isn't automatically REST or SOAP, but you can make it that way. What you need here is a tutorial:

WCF

http://www.codeproject.com/Articles/406096/A-beginners-tutorial-for-understanding-Windows

REST

http://rest.elkstein.org/

Here's some other interesting stuff:

WCF - REST / SOAP

https://msdn.microsoft.com/en-us/library/hh323708(v=vs.100).aspx

WCF and REST

https://msdn.microsoft.com/en-us/library/ee391967.aspx

Or you can do a google/bing/metacrawler/altavista search on your own.....

like image 33
Mike C. Avatar answered Oct 12 '22 12:10

Mike C.