In WCF, we have Endpoints - Address, Binding and Contracts.
Address: WHERE ?
specifies where service is located or hosted
http://localhost:8080/MyWCFServices/GetDollarRate.svc
Binding: HOW ?
specifies how to communication will be done through the WCF Service and what type of communication should be with Client and Service.
It defines how the client will communicate with the service. There are different types of protocols are available for communicating Client to the service. Depend of different types of bindings communication happens.
Contracts: WHAT ?
specifies that the functionality of service, what will service do. We can use multiple contracts for the functionality of WCF service.
[ServiceContract]
public interface IService
{
[OperationContract]
string GetData(int value);
[OperationContract]
CompositeType GetDataUsingDataContract(CompositeType composite);
// TODO: Add your service operations here
}
Address: WHERE ?
specifies where service is located or hosted
http://localhost:8080/MyWCFServices/GetDollarRate.svc
Binding: HOW ?
specifies how to communication will be done through the WCF Service and what type of communication should be with Client and Service.
It defines how the client will communicate with the service. There are different types of protocols are available for communicating Client to the service. Depend of different types of bindings communication happens.
Contracts: WHAT ?
specifies that the functionality of service, what will service do. We can use multiple contracts for the functionality of WCF service.
[ServiceContract]
public interface IService
{
[OperationContract]
string GetData(int value);
[OperationContract]
CompositeType GetDataUsingDataContract(CompositeType composite);
// TODO: Add your service operations here
}
WCF defines 4 Types of Contracts:
- Service Contract
- Data Contract
- Message Contract
- Fault Contract
No comments:
Post a Comment