Search This Blog

Thursday, 16 June 2011

Warming up to WCF -- Web Services Part 1

The world has moved to WCF but still when you go for an interview, most of the people ask you questions on web services before actually moving out to WCF...

Some very common and important question that people generally ask regarding web services are:-

1.) Do web services support method overloading?
2.) How will make your web services stateful?
3.) How will you design your service in a way that you can change the deployment     address with minimal fuss?
4.) What are the disadvantages of DCOM over web services?
5.) Why did MS created web services when there was a proprietary standard already available in form of DCOM?

Let’s start diving into the beautiful world of .Net web Services also known as XML web services...
.Net web services are a successor to DCOM (Distributed component object model)...So let’s first understand the limitations of DCOM which led to creation of Web Services:-

Limitations and Problems with DCOM:

1.)      DCOM was created with assumptions that all the nitty-gritty’s will be managed by the organization. Means all the components that will make up the application as a whole will be managed by the organization creating the application, which is not always the case since we are dependent on lots of third party apps, and how they are creates (technology) and managed (platform) is out of our immediate control.

2.)      Since DCOM is based on a proprietary standard (invented by Microsoft), its only good for windows operating systems and not well suited for heterogeneous environments.

3.)      Tight coupling between client and server is another reason for not liking DCOM. Any changes to server will mean a ripple effect on client side component as well.

4.)      Since DCOM supports binary data and TCP protocol, it’s not suited well enough for internet based applications. Remotable applications created using DCOM comes with extra burden of opening and maintaining ports, which generally sit behind firewalls in normal internet scenarios using HTTP.

Thus Xml web services came into picture. Advantages of web services included

1.)     Interoperability:-
                  Web services work out of private networks, generally deployed on a shared or           dedicated hosting environment and managed separately and thus the offer               better return on investments since one solution          can be used from multiple              places reusability) and by multiple clients since web services use SOAP over               HTTP. Web services are used to build platform independent solutions.

2.)     Reusability:-
                  With web services entire business logic can be separated into multiple web                services and let the client choose which business logic they want. So client is                  free to choose what they need instead of giving them everything as a bunch.

3.)     Deployability:-
                  Since web services are deployed over standard internet technologies, they               can be deployed over firewalls and there is no need to open additional ports                   since it’s accessible via Http ports 80 for http and 443 for https.

Still there were some disadvantages of web services:-

1.)   Security was not built into web services. Though it used built in windows authentication as well as forms authentication, we needed a well defined security framework for web services. Microsoft and IBM worked on a joint initiative which is later called WSE (Web Services Enhancements) which works as a layer over web services providing it features like security, transaction management, policy management etc.
2.)   SOAP, the underlying protocol on which web service is based is both a boon and a bane. It allows disparate system and technologies to interact with each other but if my client server is same (technology wise) then this is an overhead due to parsing of request and response at both ends. Web services doesn’t provide the flexibility to choose/switch between messaging standards i.e. SOAP for non .net client and XSD for .Net client.
3.)   Since web applications are stateless so are web services and there is extra work that’s needed at client side to make it work like a stateful service.

Feel free to comment if some more pros and cons come to your mind. I know there are lot more…

No comments:

Post a Comment