Cuando la realidad supera a la ficción.Más Info
Most applications are developed to interact with users; the user enters or searches for data through an interface and the application then responds to the user's input. A Web service does more or less the same thing except that a Web service application communicates only from machine to machine or application to application. There is often no direct user interaction. A Web service basically is a collection of open protocols that is used to exchange data between applications. The use of open protocols enables Web services to be platform independent. Software that are written in different programming languages and that run on different platforms can use Web services to exchange data over computer networks such as the Internet. In other words, Windows applications can talk to PHP, Java and Perl applications and many others, which in normal circumstances would not be possible.
Because different applications are written in different programming languages, they often cannot communicate with each other. A Web service enables this communication by using a combination of open protocols and standards, chiefly XML, SOAP and WSDL. A Web service uses XML to tag data, SOAP to transfer a message and finally WSDL to describe the availability of services. Let's take a look at these three main components of a Web service application.
The Simple Object Access Protocol or SOAP is a protocol for sending and receiving messages between applications without confronting
interoperability issues (interoperability meaning the platform that a Web service is running on becomes irrelevant). Another protocol
that has a similar function is HTTP. It is used to access Web pages or to surf the Net. HTTP ensures that you do not have to worry about
what kind of Web server -- whether Apache or IIS or any other -- serves you the pages you are viewing or whether the pages you view were
created in ASP.NET or HTML.
Because SOAP is used both for requesting and responding, its contents vary slightly depending on its purpose. Below is an example of a SOAP request and response message:
Although both messages look the same, they carry out different methods. For instance looking at the above examples you can see that the requesting message uses the GetBookPrice method to get the book price. The response is carried out by the getbookpriceResponse method, which is going to be the message that you as the "requestor" will see. You can also see that the messages are composed using XML.
How do you know what methods are available in a Web service that you stumble across on the Internet? Well, WSDL takes care of that for you. WSDL is a document that describes a Web service and also tells you how to access and use its methods. Take a look at a sample WSDL file:
The main things to remember about a WSDL file are that it provides you with:
The entire Web service concept is based on XML. Which begs the question, what is XML? XML is an eXtensible Mark-up Language that enables you to identify and organize your information in a more accurate and flexible way. It is called extensible because it does not have a fixed format. An example of a mark-up language that has a fixed format is HTML, which is an SML or Single Markup Language. The difference between the two is that with XML you can define any element and call it whatever you like, while with HTML you already have pre-defined elements and attributes. For instance, to make text appear italic in a Web browser, you use the tags. Every modern browser will know how to display that text. Without pre-defined tags like this, XML allows you to define your own tags to both display and format text. This flexibility is exactly what Web services use to make it both platform and implementation independent. XML is most widely used in RSS documents, which are used for news syndication on the Internet. Below is an example of an XML document:
When unformatted, the XML looks like this in Internet Explorer:
When formatted with an XSL stylesheet it looks like this:
The stylesheet has the following code:
We have covered a few open protocols and standards in this article that should give you enough information to understand how a Web service application works.