Page 205 - DCAP312_WEB_TECHNOLOGIES_II
P. 205

Unit 10: Web Services



                                                                                                  Notes
                                       Figure10.1: Web Services

                                                2
                                                   Web
                             1                     Services            3
                                                   Bridge
                               Standardized
                               business request  4                      Business
                                                                        process
                                   Standard protocol
                                 5
                                   Standardized
                                   business response


            The concepts used in Web Services hinge on the three following acronyms:
               •  SOAP (Simple Object Access Protocol) is a protocol based on the language, XML. It allows
                 exchanges between applications, whatever their platform. A SOAP service call is a stream
                 of ASCII text framed by XML tags and transported in the HTTP protocol.
               •  Web Services (Description Language) describes the Web Services in XML format, specifying
                 the methods that can be called, their signatures, and their access points (URL, port, etc.). To
                 some extent, it is the equivalent of CORBA's IDL language for distributed programming.
               •  UDDI (Universal Discovery Description and Integration) standardizes the use of distributed
                 directories for Web Services, allowing both publishing and discovery. UDDI behaves like
                 a Web Service itself, its methods being called using the SOAP protocol.
            A significant advantage of Web Services, relative to other distributed architectures, is the support
            of firewalls. By using the HTTP protocol on port 80, which is generally not secured, the Web
            Services can get into the enterprise without being blocked by firewalls.

            However, this creates other safety concerns because the default use of these characteristics is
            too permissive. It is necessary to take this into account at the protocol levels.

            A Web Service Example
            In the following example we will use ASP.NET to create a simple Web Service that converts the
            temperature from Fahrenheit to Celsius, and vice versa:
                     <%@ WebService Language= “VBScript” Class= “TempConvert” %>
                     Imports System
                     Imports System.Web.Services
                     Public Class TempConvert :Inherits WebService
                     <WebMethod()> Public Function FahrenheitToCelsius
                     (ByVal Fahrenheit As String) As String
                      dim fahr
                     fahr=trim(replace(Fahrenheit, “, “, “.”))
                     if fahr= ““ or IsNumeric(fahr)=false then return “Error”
                     return ((((fahr) - 32) / 9) * 5)
                     End function
                     <WebMethod()> Public Function CelsiusToFahrenheit
                     (ByVal Celsius As String) As String
                     dim cel


                                             LOVELY PROFESSIONAL UNIVERSITY                                   199
   200   201   202   203   204   205   206   207   208   209   210