Showing posts with label WCF. Show all posts
Showing posts with label WCF. Show all posts

Saturday, June 9, 2012

What is ABC of an Endpoint in WCF?

Endpoint: It is a communication point where a client can communicate with the service by making use of endpoint.

Endpoint must be existing in the client as well as in service.

Address(Where): Address indicates where we can find this service. Address is a url which points location of service.

Binding(How): It specifies message patterns, security and channel information which are required to access the service.

Contract(What): It specifies what exactly service does. It describes parameters and return values for a method.

what is wsdl, soap, Disco, UDDI in SOA(Service oriented applications)?

WSDL(Web Service Description Language): Used to create interface definitions for web service it says to clients what methods are available in service.

SOAP(Simple object Access Protocol): It is a Xml based language and used to create request and response messages.

DISCO(Discovery) : Used to create documents that provide links to multiple web service endpoints.

UDDI(Universal discovery, Description and integration): A standard for creating business registries that catalog companies, the web services they provide and corresponding urls wsdl documents.

Explain contracts in wcf?

Contract is an agreement between 2 or more parties. It defines how client should communicate with your service. Technically it describes parameters and return values for a method.

Contract is a platform neutral and standard way of describing what a service does

There are 4 types of contracts.
1.Service contract.
2.Message contract.
3.Data contract.
4.Fault contracts.

Service contract:It provides list of operations provided by a service.A client can make use of operations with the help of service contract.
End point provides implementation regarding service contract. each operation in service contract must be defined as operation contract.

Message Contract: Default soap message will be provided by wcf run time for communication between client and service. If it is not meeting your requirement then we can create our own message format.

Operation Contract: It describes which methods should be exposed as a service by using the service.

Data Contract: It defines which types of complex data will be exposed between the client and service. they determine which parameters to be serialized. wcf implicit contracts for built in types such as int and string but we can easily define explicit operation contract for custom types.
DataContract  --Attribute used to define the class
DataMember -- Attribute used to define properties

WCF uses xml, xsd, soap and binary formats as transmission languages. you can choose any one of them.


Fault Contracts: define which errors to be raised by the service and how the service handles and propagate errors to clients.





Explain Message and message patterns in wcf?

Message: It is a packet of information that can be exchange message in the form of soap message.

The soap message is transmitted in the form of soap envelop.

Message patterns
 
Simplex : Client sends a message and never expects a rsponse.
Duplex: Client and service can communicate each other with out waiting for others to respond.
Request & Reply: Client send a message and it will wait until services gives response.

Friday, June 8, 2012

Differences between WCF and web service?

Web services can be hosted on IIS.
WCF can be hosted in IIS, Windows Activation services, self hosting and windows service.
[Web service] attribute has to be added to class in web services.
[Service contract] attribute has to be added to class in wcf.
[web method] attribute represents the method exposed to client in web service.
[Operation contract] attribute represents the method exposed to client in wcf.
One-way,Request-Response are different operations supported by web service.
One-way, Request-response, Duplex operations supported by wcf services.
System.Xml.Serialization namespace is used for serialization in web service.
System.Runtime.Serialization namespace is used for serialization in wcf.
web service uses security protocol.
Security, reliable, messaging, Transaction protocols are used in wcf.

wcf and its advantages

WCF is a unified programming model provided in .net framework3.0  wcf is a combination feature of web services, .Net remoting, MSMQ and com+.

By using wcf we can implement a service which is of language independent, platform independent, application independent and protocol neutral.

WCF is a collection of operations where we can find at least one end point with complete service description.

wcf advantages
Interoperability is fundamental characterstic of wcf.
It provides better reliability and security compared to asmx.
No need to make code changes in code for implementing security model and changing binding. small changes in configuration will make your requirement.
It has integrated logging mechanism, changing configuration will provide this functionality.