Thursday 4 June 2015

What are the WCF specifications ?

In this post I explained what are the specifications does WCF  follow. You can learn more about WCF in my other post by clicking on WCF menu tab.

Web Service standards and specifications are known as "WS-*". These represents a set of protocols and specifications. These are used to extend the capability of web service.

The Web Services Interoperability Organization (WS-I) is an industry group to promote interoperability across the stack of web services specifications. It publishes web service profiles, sample applications, and test tools for help. One of the popular profiles it has published is the WS-I Basic Profile. WS-I is governed by a Board of Directors, and Microsoft is one of the board members.

WCF supports specifications defined by WS-* specifications. WS-* specifications are defined together by Microsoft, IBM, SUN, and many other big companies so that they can expose there services through a common protocol. WCF supports all specifications defined and now we will learn them one by one.

1. Messaging (WS-Addressing): -

SOAP is the fundamental protocol for web services. WS Addressing defines some extra additions to SOAP headers, which makes SOAP free from the underlying transport protocol. One of the good things about message transmission is MTOM, also termed as Message Transmission Optimization Mechanism. They optimize the transmission format for SOAP messages in XML-Binary format using XML optimized packaging (XOP). Because data will sent in binary and optimized format, it will give us a huge performance gain.

2. Security (WS-Security, WS-Trust, and WS-Secure Conversation):-

 All the three

  1. WS-Security, 
  2. WS-Trust, and
  3. WS-Secure Conversation

WS- define authentication, security, data integrity, and privacy features for a service.

3. Reliability (WS-Reliable Messaging): -

Reliability specification ensures end-to-end communication when we want SOAP messages to be transmitted over the network back and forth many times.

4. Transactions (WS-Coordination and WS-Atomic Transaction):

 These two specifications WS-Coordination and WS-Atomic Transaction enable transaction with SOAP messages.

5. Metadata (WS-Policy and WS-Metadata Exchange): -

WSDL is an implementation of the WS-Metadata Exchange protocol. WS-Policy defines more dynamic features of a service, which cannot be expressed by WSDL. We have stressed on the WS-* specification as it is a specification which a service has to follow to be compatible with other languages. Because WCF follows WS-* specifications, other languages like Java, C++ can also exploit features like Messaging, Security, Reliability, and transactions written in C# or VB.NET. This is the biggest achievement of WCF to integrate the above features with other languages.



These are the specificationd followed by WCF. I hope its very useful and you enjoyed this post. Please comments your feedback and questions.



Sunday 31 May 2015

What are WCF bindings and How to choose WCF binding ?

Here In this post I expalined all bindings in WCF. The cinarios where which binding is most suitable and what they supports.


Bindings and Explaination:-

Sl.No
Binding Name
Binding class and Description
1
Basic binding
We use BasicHttpBinding class to implement this binding. It is designed to expose a WCF service as an ASMX web service (asp.net web service), so that old clients (which are still using ASMX web service) can consume new service. By default, it uses Http protocol for transport and encodes the message in UTF - 8 text for-mat. You can also use Https with this binding.
2
Web binding
We use WebHttpBinding class to implements this binding. It is designed to expose WCF services as Http requests by using HTTP-GET, HTTP-POST. It is used with REST based services which may give output as an XML or JSON format. This is very much used with social networks for implementing a syndication feed.
3
Web Service (WS) binding
We use WSHttpBinding class to implement this binding. It is similar to Basic binding and uses Http or Https protocols for transport. But this is designed to offer various WS - * specifications such as WS – Reliable Messaging, WS - Transactions, WS - Security and so on which are not supported by Basic binding.
 wsHttpBinding = basicHttpBinding + WS-* specification
4
WS Dual binding

We use WsDualHttpBinding class to implement this binding. It is similar to wsHttpBinding except it sup-ports bi-directional communication means both clients and services can send and receive messages.
5
TCP binding
We use NetTcpBinding class to implement this binding. It uses TCP protocol to communicate between two machines with in intranet (means same network). It encodes the message in binary format. This is faster and more reliable binding as compared to the Http protocol bindings. It is only used when communication is WCF  to WCF means both client and service should have WCF.
6
IPC binding

We use NetNamedPipeBinding class to implement this binding. It uses named pipe to Communicate between two services on the same machine. This is the most secure and fastest binding among all the bindings.
7
MSMQ binding

We use NetMsmqBinding class to implement this binding. It uses MSMQ for transport and offers sup-port to disconnected message queued. It provides solutions for disconnected scenarios in which service processes the message at a different time than the client send the messages.
8
Federated WS binding
We use WSFederationHttpBinding class to implement this binding. It is a specialized form of WS binding and provides support to federated security.
9
Peer Network binding

We use NetPeerTcpBinding class to implement this binding. It uses TCP protocol but uses peer net-working as transport. In this networking each machine (node) acts as a client and a server to the other nodes. This is used in the file sharing systems like torrent.
10
MSMQ Integration binding
We use MsmqIntegrationBinding class to implement this binding. This binding offers support to communicate with existing systems that communicate via MSMQ.


How to choose binding and which binding is most suitable in wchich cinarios:-




What they supports:-

Sl.No
Binding Name
Message Encoding
Protocol
Security
Transaction
Bi-directional
1
Basic binding
Text
Http, Https
None
-----
------
2
Web Service (WS) binding
Text
Http, Https
Message
Yes
------
3
WS Dual binding
Text
Http, Https
Message
Yes
Yes
4
TCP binding
Binary
TCP
Transport
Yes
Yes
5
IPC binding

Binary
Named pipe
Transport
Yes
Yes
6
MSMQ binding

Binary
MSMQ
Message
Yes
No
7
Federated WS binding
Text
Http, Https
Transport
Yes
No
8
Peer Network binding

Binary
Peer to Peer
Transport
No
Yes
9
MSMQ Integration binding
Not Supported
MSMQ
Transport
Yes
-----



In the above post I explained WCF bindings. Ihope its very useful to you. So please comments your feedback, question regarding this post.