15.1. Web service protocols

To communicate with web services, we can use HTTP-GET, HTTP-POST or SOAP protocols. HTTP-GET and HTTP-POST use HTTP as an underlying protocol and encode parameters as name/value pairs in the HTTP request. The GET method appends data to the URL of the server-side script, while POST methods encode name/value pairs in the body of the HTTP request message. The following examples show HTTP-GET and HTTP-POST requests and responses for the web service (for a description of this service see under Creating a web service later in this chapter). First is HTTP-GET:

GET /WebServices/wsdemo.asmx/GreetUser?Name=string HTTP/1.1 
Host: localhost 
HTTP/1.1 200 OK 
Content-Type: text/xml; charset=utf-8 
Content-Length: length <?xml version="1.0" ...

Get A Programmer's Guide to .NET now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.