Tech NovoGeek

...Technology Simplified

Showing posts with label Web Services. Show all posts

Wednesday, May 16, 2012

WCF Vs Web Services

No comments :

WCF/ASP.Net Web Services are used for developing web services. Here is a list of differentiation between these two.

Feature

ASP.NET Web Service

WCF

Data Transformation

To and from Data Transition is done through XML Serializer

DataContractSerializer is used for data transition

File Extension

asmx

.svc

Webmethods vs DataContract Attributes

ASP.NET WebService uses Webmethods to translate .NET FW types in to XML.

WCF uses the DataContractAttribute and DataMemeberAttribute to translate .NET FW types in to XML.

Limitations

Only Public fields or Properties of .NET types can be translated into XML.Only the classes which implement IEnumerable interface. ICollection interface can be serializable

Public/Private fields or properties of .NET types can be translated.

IDictionary Interface class

Classes that implement the IDictionary interface, such as Hash table can not be serialized.

The DataContractSerializer can translate the Hash Table into XML. Hence using WCF we can even translate HashTable into XML

Security

WCF is more secured than WebService

It is based on WS Standards. capable to run in any .NET executable, so it needs independent security capabilities.

Transfer security=Responsible for providing message confidentiality, data integrity, and authentication of communicating parties.
Authorization Responsible for providing a framework for making authorizationdecisions.
Auditing Responsible for logging security-related events to the audit log

Binding

Web service supports only HTTP.

WCF supports multiple bindings HTTP,TCP,MSMQ,WS-HTTP etc

Messaging

ASP.Net web service uses only SOAP for sending and receiving data. It uses Xml Schema  to  defines structure of message.

WCF can send message in any format. It uses SOAP for communication by default. It can use any other transport protocol for message transport .

Performance

Slower compared to WCF

The main advantage of the design of the DataContractSerializer is better performance over XML serialization

Fields / Properties

XMLSerialization does not indicate the which fields or properties of the type are serialized into XML

DataContratSerializer Explicitly shows the which fields or properties are serialized into XML

Exception handling

In ASP.NET Web services, Unhandled exceptions are returned to the client as SOAP faults.

In WCF Services, unhandled exceptions are not returned to clients as SOAP faults. A configuration setting is provided to have the unhandled exceptions returned to clients for the purpose of debugging.

Example

[WebService]
public class Service : System.Web.Services.WebService
{
[WebMethod]
public string Demo(string strDemog)
{
return strDemo;
}
}

[ServiceContract]
public interface ITest
{
[OperationContract]
string ShowMessage(string strDemo);
}
public class Service : ITest
{
public string Demo(string strDemo)
{
return strDemo;
}
}

After you know the importance of the WCF on WebServices, We can create our Sample WCF application in next blog post.

Monday, May 14, 2012

Review of Web services

No comments :
Before we proceed further into WCF in future posts just let’s get a basic understanding on Web services.
Web Service is a web application which expose list of methods (business logic) over Network.
Web service uses 2 protocols.
HTTP: For transportation.
SOAP: For Messaging.
Using a Web service, different applications developed in different technologies can communicate, called as interoperability.
Sample Webservice:
Let’s create a sample web service in ASP.Net
Open Visual studio 2010 » File » New » Website » Select Visual C# Language » Select .Net Framework versions <4.0 » so we select 3.5 » select optional path required »
This creates a sample Helloworld service » Execute the website
» It displays the Service.asmx page with the hello world method » If you open that method » which further displays SOAP Messages with Envelope and Body in XML format.
See the diagram for reference

image

Limitations of Web service:
Web service can be hosted only on IIS.
Web services uses only HTTP Protocol.
Web service doesn’t provide compression of SOAP Messages.
Message Level Security is not provided by web services.
No reliable Transaction Management.

Microsoft and IBM has come up with Web service extensions like WS-Security, WS-Transactions etc.. which is different programming model.
So WCF is introduced which is unification of all these technologies with a similar programming model.
WCF is Framework introduced in .Net3.0 in year 2006.
We shall discuss detailed Architecture and implementation of WCF in future posts.

Friday, May 11, 2012

The specified service has been marked for deletion error message when removing a service

No comments :
If you receive this message while trying to delete a windows service
check if the Services.msc application is open, if so try closing and then try deleting it PRIOR uninstalling the service (using installutil /u service_exe_name).
Hope this helps.

Tuesday, April 24, 2012

Location of wsdl.exe

No comments :

C:\Program Files\Microsoft SDKs\Windows\v7.0A\bin