What are Xml Web Services by bns26590


									 What are Xml Web Services?

1.   A Web Service simply an application that exposes a Web-
     accessible API .

2.   Web services are a new, standard platform for building
     interoperable distributed applications.

     –   The Web services platform is a set of standards that
         applications follow to achieve interoperability via the
     –   You write your Web services in whatever language and
         on any platform you like, as long as those Web services
         can be viewed and accessed according to the Web
         services standards.
          About Web Services
• Web Services, unlike DCOM or CORBRA, are founded on
  universal, nonproprietary standards including XML and HTTP
  and offer a model that is platform independent;
  communicate using platform-independent and language-
  neutral Web protocols.
• The Web services platform uses XSD as its type system.
  XML provides a simple way of representing data, but it says
  nothing about the standard set of data types available and
  how to extend that set. The data types you use must be
  translated to XSD types to conform to the Web services
• Web services are not exclusive to .NET.
• NET includes several tools and a degree of support which
  simplify development of Web Services by automating many
  tasks involved and shielding the developer form many of the
  technical details.
       More About Web Services
• Your Web service will sit behind a Web server, typically
  Internet Information Server (IIS).
• Support loosely coupled connections between systems.
• Works through existing proxies and firewalls.
• Can take advantage of HTTP authentication.
• Encryption for free with SSL.
• Web services only receive and return XML.
• Provide a stateless model similar to the singlecall activation
  mode. When a client invokes a remote method,the Server
  automatically constructs the relevant object, executes the
  method, returns any results, and discards the object. It is
  possible however, to maintain between method calls using
  the ASP.NET session object.
 How are web services different
from earlier models of distributed
   computing, such as Corbra?

 Key differences:

 1.   loosely specified and coupled
 2.   build on top of existing, ubiquitous infrastructure
      like HTTP and XML.
 How are Web Services Described?
• Web Services are described using WSDL (Web Services
  Description language). These descriptions may be stored with
  the service itself or published in a UDDI registry.
• WSDL is an XML-based grammar for describing Web services,
  their functions, parameters, and return values.
• .NET’s web service infrastructure will automatically generate
  the necessary WSDL to fully describe a .NET web service.

• .NET also provides tools that can consume WSDL descriptions
  of services and use these descriptions to generate proxy
  classes for use in client applications. So developers using .NET
  can remain ignorant of WSDL (and even SOAP) and create
  Web Services.
Service Description
   <?xml version="1.0"?>
     <httpget xmlns="urn:schemas-xmlsoap-org:get-sdl-2000-01-25">
             <param name="placeName"/>
             <param name="MaxItems"/>
             <param name="imagePresence"/>
             <mimeXml ref="s0:ArrayOfPlaceFacts"/>
How to Create a Web Service

To build a .NET Web service you create a file with the .asmx
 Viewing a Test Page for the Web Service

The framework provides built-in support for viewing and
accessing methods exposed by a Web service. By accessing the
Web service .asmx file, the framework automatically displays
the public methods, as shown in figure below.
    Testing the Web Service Continued
•   The service method help page shows the XML representation of the
    request and response for the Web service, its arguments, and return
    types. You can also use the displayed HTML form to test the method.
 How are Web Services Invoked?

• Soap (Simple Object Access Protocol) is the communications
  protocol for Xml Web Services.
• The Soap specification provides standards for the format of
  a SOAP message and how SOAP should be used over HTTP,
  which it uses as the transport layer to move structured type
  information across the Internet.
• SOAP also builds on XML and XSD to provide standard rules
  for encoding data as XML.

• Invoking a Web service from either a Web or desktop
  application is a simple matter of object instantiation and
  invocation. But which Object? This is where the proxy class
  comes into play.
Example of a SOAP Request
                      Proxy Classes
•   The Proxy class is responsible for the following:
     –   Generate SOAP request
     –   Send to the target service
     –   Receive the SOAP response
     –   Parse the SOAP Generate an object
     –   Return the object as a result

•   The developer tools provided with the .NET SDK and Visual Studio
    .NET remove the need for the developer to work at the SOAP level.
    Instead, clients may calls against a proxy object derived from
    System.Web.Services.Protocols.SoapHttpClientProtocol and .NET takes care of
    setting up, formatting and transmitting messages.
•   The proxy class can be generated automatically using the command-
    line utility wsdl.exe.
•   Contains not only the default constructor, but also methods to
    invoke the web service both synchronously and asynchronously.
Example of a Proxy Class
Example for invoking a temperature Web
  service from an ASP.NET Web page
             What is UDDI?

•   Result of the combined efforts of several technology
    companies (chiefly IBM and Microsoft) to produce a
    global Internet-based registry of businesses and the
    web services they provide.

•   UDDI represents a set of protocols and a public
    directory for the registration and real-time lookup of
    web services and other business processes.

•   “Yellow pages” of Web Services
                 UDDI continued
Consists of 2 parts:

    1.   First, UDDI is a technical specification for building a
         distributed directory of businesses and Web services. Data
         is stored within a specific XML format, and the UDDI
         specification includes API details for searching existing data
         and publishing new data.

    2.   Second, the UDDI Business Registry is a fully operational
         implementation of the UDDI specification. The UDDI
         registry enables anyone to search existing UDDI data, for
         example, for providers of service in a specified geographic
         location or for businesses of a specified type. It also enables
         any company to register themselves and their services.
               UDDI continued
The data captured within UDDI is divided into three main

• White Pages: This includes general information about a
  specific company. For example, business name, business
  description, and address.
• Yellow Pages: This includes general classification data for
  either the company or the service offered. For example, this
  data may include industry, product, or geographic codes
  based on standard taxonomies.
• Green Pages: This includes technical information about a
  Web service. Generally, this includes a pointer to an
  external specification, and an address for invoking the Web
When to Use Web Services?
Web Services offer the most benefit in cases where
applications need to communicate across platform boundaries
and over the Internet:

Business to Business Integration
Integrating business processes across multiple businesses is
commonly referred to as business-to-business integration. By
using Web services, a business can expose vital business
processes to authorized suppliers and customers.

   Example: You can expose electronic ordering and invoicing
   thereby enabling your customers to electronically send you
   purchase orders and your suppliers to electronically send you
Application Integration
A good portion of development efforts is spent integrating
applications written in various languages and running on
different systems.

   Example: You need to get data into your application from a
   legacy application running on an IBM mainframe or you need to
   send data from your application to a mainframe or Unix-based
   application somewhere. Even on the same platform, applications
   from different vendors often need to be integrated. By
   exposing some of its functionality and data via a Web service,
   an application provides a standard mechanism for other
   applications to integrate with it.

Communicating through a firewall
Software Reuse
Software reuse has always been limited by one key factor: you
can reuse the code but not the data behind the code. The
reason for this is you cannot easily distribute data unless it is
fairly static data not expected to change much. Web services
let you reuse code along with the data it needs.

    Example: If your application’s user enters a mailing address that you
    want to validate, you could send it to an address verification Web
    service. This service can lookup the street address, city, state and zip
    code to make sure the address exists and in the specified zipcode. A
    service like this is not possible with component reuse, you need to have
    the current database of street addresses, cities, states and zip codes.

Another scenario for software reuse is when you are building
an application that aggregates the functionality of several
other applications: you can use Web services to aggregate
functionality from many applications into one, consistent, user
When Not to Use Web Services
Situations where using Web Services will cost you

Single Machine Applications
Applications that need to communicate with others running
on the same machine. In this case, it is almost always better
to use a native API rather than a Web service because they
require relatively little overhead.

Homogeneous Applications on a LAN
Homogenous applications running on the same machine or on
different machines that need to communicate on the same
          Web Service Review
                       Service Side
•Write the service code
–Expects SOAP as input
•Define the externally visible methods
•Create the WSDL description of those methods
•Publish the WSDL
•Run the service
                           Client Side
•Locate the WSDL
•Load the WSDL
•Convert to a client proxy
•Write the client code, calling proxy
–Generates and sends SOAP

To top