The essential difference between webapi and webservice

webapi is http protocol, the protocol webservice using a soap 
webapi stateless webservice relatively more lightweight. webapi support such as get, post operations such as http
The essential difference
http: is a client and server side request and response standard (TCP). http protocol whose purpose is to provide a method for publishing and receiving htttp page of 

the interactive client http protocol and a server: the HTTP client initiates a request to the server to establish a designated port (default port 80) of the TCP connection . HTTP server that is sent over the port to listen for client requests. Upon receiving the request, the server (the client) sends back a status line, such as "HTTP / 1.1 200 OK", and the (response) message, the message body of the message may be requested file, an error message, or some other information . 

soap protocol: It describes how a lightweight protocol for exchanging information in a decentralized or distributed environment. soap based on http protocol, an XML-based protocol. 

Different: all the underlying communication protocol, the request packet is different formats, SOAP packet format is XML, HTTP plain text. 

Relationship: SOAP is a communication protocol, SOAP based on HTTP protocol, to write to XML REQUEST parameter on the HTTP BODY submit a WEB SERVICE server (SERVLET, ASP or something) after processing is complete, the results are written in XML as RESPONSE back to the UE, in order to make the UE and WEB SERVICE may correspond to each other, it can be described using WSDL file as this communication scheme, and the frame can be automatically generated file WS client using WSDL tool, SOAP comprising the complex bound to the target sequence XML's ability to go.
http soap relations
1, when you want to create a support message, the message queue service, duplex communication, you should choose WCF 
  2, when you want to create a service, you can use faster transmission channels, like TCP, Named Pipes or even UDP (in WCF4.5), while the rest of the transmission channel may be unavailable to support HTTP. 
  3. When you want to create a resource for HTTP-based service and can use all the features of HTTP (such as URIs, request / response header, cached, version control, a variety of content formats), you should choose the API Web 
  4, when when you want your service for browsing, mobile phones, iPhone and tablets, you should select the Web API
WEB API WCF and choose which?

Guess you like

Origin www.cnblogs.com/652769324qq/p/12070886.html