22
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 Web. 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.

What are Xml Web Services?

  • Upload
    adah

  • View
    39

  • Download
    1

Embed Size (px)

DESCRIPTION

What are Xml Web Services?. A Web Service simply an application that exposes a Web-accessible API . Web services are a new, standard platform for building interoperable distributed applications. - PowerPoint PPT Presentation

Citation preview

Page 1: What are Xml Web Services?

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 Web.

– 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.

Page 2: What are Xml Web Services?

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 standards.

• 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.

Page 3: What are Xml Web Services?

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.

Page 4: What are Xml Web Services?

How are web services different from earlier models

of distributed computing, such as Corbra?

Key differences:

1. loosely specified and coupled2. build on top of existing, ubiquitous

infrastructure like HTTP and XML.

Page 5: What are Xml Web Services?

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.

Page 6: What are Xml Web Services?

Example of a Service Description<?xml version="1.0"?>

<serviceDescription xmlns:s0="http://tempuri.org/" name="TerraService" targetNamespace="http://tempuri.org/" xmlns="urn:schemas-xmlsoap-org:sdl.2000-01-25"> <httpget xmlns="urn:schemas-xmlsoap-org:get-sdl-2000-01-25"> <service> <requestResponse name="GetPlaceList" href="http://207.46.235.37/terranet/terraservice.asmx/GetPlaceList"> <request> <param name="placeName"/> <param name="MaxItems"/> <param name="imagePresence"/> </request> <response> <mimeXml ref="s0:ArrayOfPlaceFacts"/> </response> </requestResponse> </service> </httpget> </serviceDescription>

Page 7: What are Xml Web Services?

How to Create a Web Service

To build a .NET Web service you create a file with the .asmx extension.

Page 8: What are Xml Web Services?

Viewing a Test Page for the Web Service

The framework provides built-in support for viewing andaccessing methods exposed by a Web service. By accessing theWeb service .asmx file, the framework automatically displaysthe public methods, as shown in figure below.

Page 9: What are Xml Web Services?

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.

Page 10: What are Xml Web Services?

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.

Page 11: What are Xml Web Services?

Example of a SOAP Request

Page 12: What are Xml Web Services?

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.

Page 13: What are Xml Web Services?

Example of a Proxy Class

Page 14: What are Xml Web Services?

Example for invoking a temperature Web service from an ASP.NET Web

page

Page 15: What are Xml Web Services?

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

Page 16: What are Xml Web Services?

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

Page 17: What are Xml Web Services?

UDDI continued

The data captured within UDDI is divided into three maincategories:

• 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 service.

Page 18: What are Xml Web Services?

When to Use Web Services?

Web Services offer the most benefit in cases whereapplications need to communicate across platform boundariesand over the Internet:

Business to Business Integration

Integrating business processes across multiple businesses iscommonly referred to as business-to-business integration. Byusing Web services, a business can expose vital businessprocesses to authorized suppliers and customers.

Example: You can expose electronic ordering and invoicingthereby enabling your customers to electronically send youpurchase orders and your suppliers to electronically send youinvoices.

Page 19: What are Xml Web Services?

Application Integration

A good portion of development efforts is spent integrating

applications written in various languages and running ondifferent systems.  

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

Communicating through a firewall

Page 20: What are Xml Web Services?

Software ReuseSoftware reuse has always been limited by one key factor: youcan reuse the code but not the data behind the code. Thereason for this is you cannot easily distribute data unless it isfairly static data not expected to change much. Web serviceslet you reuse code along with the data it needs.

Example: If your application’s user enters a mailing address that youwant to validate, you could send it to an address verification Webservice. This service can lookup the street address, city, state and zipcode to make sure the address exists and in the specified zipcode. Aservice like this is not possible with component reuse, you need to

havethe current database of street addresses, cities, states and zip codes.

Another scenario for software reuse is when you are buildingan application that aggregates the functionality of severalother applications: you can use Web services to aggregatefunctionality from many applications into one, consistent, userinterface.

Page 21: What are Xml Web Services?

When Not to Use Web Services

Situations where using Web Services will cost you performance:

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 LAN.

Page 22: What are Xml Web Services?

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