There are basically two types:
1) ASMX Web Service
These use the [WebMethod] attribute to assign to methods we want to expose
These are much simpler than WCF web references.
These must be added using the Web Reference
This is a wrapper over the wsdl.exe and can be used to create proxies for .NET 1.1 and .NET 2.0
2) WCF Services
Windows Communication Foundation (WCF)
This is a wrapper over svcutil.exe
It creates client proxies and also web.config entries.
All communications with a WCF Service occur through endpoints.
Each endpoint contains the following information:
Address - where to find the service (represented by the EndPointAddress class). Every endpoint must have a unique address.
Binding - how the communication is performed
Contract - specifies which operations are available
These must be added using the Service Reference
Service Reference is the name given to a whole bunch of different types of reference services of which a web reference (or web service) is one type
Visual Studio 2008 introduced WCF services. We program to a specific contract , we attribute an interface, these are more complicated and more powerful.
URI - (Uniform Resource Identifier) represents the address
Identity - represents the security identitiy
Headers - (optional) - providing more detailed addressing information.
EndPoints provide clients with access to the service
If any of the following Address, Binding or Contrat are changed then a new proxy must be created.
EndPoint Specification in a Config File
EndPoint Specification in Code
This can be done using the EndPointAddress class
The URI can be a full path or a path relative to the service base address.
In order to use a WCF Service you need to create a WCF client proxy.
In Visual Studio this client proxy is created for you when you add the Service Reference.
If you don't want to add a service reference you can achieve the same result using svcutil.exe
Synchronous - the caller waits for the web service to respond before continuing
Asynchronous - the caller can continue to use the thread while waiting for the web service to respond.