Friday, September 11, 2009

Web Services in C#


Web Service is known as the software program. These services use the XML to exchange the information with the other software with the help of the common internet Protocols. In the simple term, we use the Web Service to interact with the objects over the internet.

Here are some points about the Web Service

  1. Web Service is not dependent on any particular language.
  2. Web Service is a protocol Independent.
  3. Web Service is platform-independent.
  4. Web Service is known as the Stateless Architecture. These services are dependent only on the given input.
  5. Web Service is also Scalable.
  6. Web Service is based on the XML (Open, Text-Based Standard).

Technology Used in Web Service:

XML: Web Service specifies only the data. So, the application which understands the XML regarding the programming language or the platform can format the XML in different ways.

SOAP: The communication between the Services and the application is set up by the SOAP.

WSDL: WSDL gives us a uniform method that is helpful to specify the Web Services to the other programs.

UDDI: With the help of UDDI, we can search the Web Service registries.

At the time of the deployment of these technologies, this allows the developers to do the packaging of the applications in the form of the Service and publishing of the Service on the network.

Advantages of Web Services:

  1. Web Services always use the open, text-based standard. Web service uses all those components even they are written in various languages for different platforms.
  2. Web Service promotes the modular approach of the programming so that the multiple organizations can communicate with the same web service.
  3. Web Services are easy to implement but expensive because they use the existing infrastructure, and we can repackage most of the applications as the Web Service.
  4. Web Service reduces the cost of enterprise application integration and B2B communications.
  5. Web Services are the interoperable Organization that contains the 100 vendors and promote them interoperability.

Limitations of Web Services:

Limitation of Web Services are:

  1. One of the limitations of the Web Services is that the SOAP, WSDL, UDDI requires the development.
  2. Supports to the interoperability is also the limitation of the Web Service.
  3. The limitation of web service is also royalty fees.
  4. If we want to use web services for the high-performance situation, in that case, web service will be slow.
  5. The use of web service increases the traffic on the network.
  6. The security level for Web Services is low.
  7. We use the standard procedure to describe the quality of particular web services.
  8. The standard for the Web Service is in the draft form.
  9. To retain the intellectual property of the specific standard by the vendor is also the limitation of the web service.

Example of the Web Service:

Web Service can do almost any kind of task.

Web Portal: Web portal is used to fetch the headline news from the linked web service.

Weather Reporting: For the reporting of weather, we will use Weather Reporting Web Service for displaying the information about the weather on our website.

Stock Quote: The latest information about the share market with the Stock Quote can display on our website.

News headline: By using the news headline Web Service, we can show the latest update of the news on our website.

We can make our web service and can give them back to use. Here we are taking an example like we can make the Free SMS Sending Service with the footer for the company advertisement. So, whenever any person uses this Service, they will indirectly advertise our company. For taking advantage of the web service, we can apply the N number of ideas.

For creating the Web Service first, we will think about a scenario. For creating any web service, firstly, we should have to get to know why we need Web Service.

The need for Web Service:

We will think about a scenario which we want to show on our website. On our website, we want to show the information about the region, nation and about the international as well. Here if we are thinking of writing the code for all these functionalities, this will take lots of time and the effort to write the code for all these functionalities. All of the above information is already provided by some existing sites, so in that case, we want to use that current logic of other sites. But there is a problem arises how could I use the existing logic in my application.

The solution to this problem is Web Services.

By using the Web Service, we can reuse someone else's business logic, instead of replicating this. To use the business logic of someone else, we just have to write a few lines of the code. This technique is similar to the libraries of API, DLLs, and plug-ins.

The only difference between the libraries of API and the Web Service is that the Web Service is located remotely on another server.

Web Services can be invoked by the other applications. Web Services are known as the pieces of the business logic, which is hosted on the internet, and the other application can use them.

Here we have some points about the Web Services.

Note1: Web Services are not limited only to the .Net Framework. The standards of Web Services were already defined before the release of the .NET. Web Services and supported by the vendors other than Microsoft.

Note:2: Web Services can also work on the cross-platform. If the services were written in one language, these could be used by the other application despite, and the application used the other language. If we want to use the web services, the only way for that is we only need the internet to connect where we will make the HTTP request.

As we know that the Web Service is cross-platform, but despite this, there should be an understandable language so that we can make a request for the services and can get the Service in their response. Web Services use the XML, which can be understood easily.

This is the only reason why the web services were built with the XML based standards of exchanging the data.

Web Services uses the Set of Data type. The XML Schema easily recognizes these data types.

Web Services uses a simple data type like strings and numbers. These data types are helpful for communication with Web Services. And we cannot send the proprietary .NET objects like image, FileStream, or the EventLogs. The other programming language does not have any way to contact these .NET objects. If we use some devices to send them to the client, still the different programming languages will not be able to interpret.

Note:3 If we want to work with the .NET objects, we can use the .NET remoting. .NET remoting is known as distributed technology through which we can use the .NET objects. But the non-.NET client can't use it.

Data Types supported by the Web Service:

  • Built-in Types (Basic):
    Data Types used by the Web Services are:
    Web Services uses the built-in C# data types like short, int, long, short, float, char, byte, string, and DateTime.
  • Objects: WPF uses the object of the user-defined class. In spite of this thing that the class contains the methods, the class will not be possible to transmit to the client.
  • Arrays: WPF uses the arrays of any supported data type (built-in or customs). We can also use the ArrayList in WPF.
  • Enumerations: WPF supports enum. For the value of the enumeration, WPF uses the string name. WPF will not use integer.
  • XmlNode: Objects which are based on the System.Xml.XmlNode represents the portion of the XML document. We can use the XmlNode to send the arbitrary XML.

DataSet and DataTable: The WPF supports dataSet and DataTable, but the WPF does not support the ADO.NET data objects like DataColumns and DataRows.

1 comment:

Anonymous said...

"How-do-you-do, just required you to understand I've extra your web page to my Yahoo bookmarks because of your remarkable blog site layout. But significantly, I believe your web page has one of the freshest theme I've arrived across. It seriously helps make studying your blog site a lot less difficult."

Popular Posts