1. Trang chủ
  2. » Trung học cơ sở - phổ thông

aspnet information technology

22 9 0

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

registered in a registry for access to users A service can be called from another program using interface Service... Internet with Web Services.[r]

(1)

Session 17

(2)

Review

 Controls help in reusability of visual as well as functional capabilities

 Custom web controls can be created in two ways:

 Pagelets

 Web Controls using C#

 Pagelets are custom controls that look like an asp page, and have the

extension ascx

 Web Controls render HTML automatically

 Custom Controls, which compose of other controls as well, are known

as composite controls

 The System.Web.UI.INamingContainer interface has no methods;

(3)

Objectives

Explain Web Services

Create Web Services using ASP.net

Consume Web Services using various protocols Create proxies for Web Services

(4)(5)

Service Service has

to be

(6)

Internet with Web Services

Web Server

Web Server

Web Server Constellation

Sites, services, and devices

collaborate

(7)

Create a Web service

Define service interface and invocation methods for Web services

Publish Web services on Intranet or Internet Find Web service in order to use it

Invoke the web service in order to use it

(8)

Accessed over the web Called using its Interface

Registered in a service registry

Standard Web protocols to communicate Loose coupling

An important aspect of loose coupling is that Web

services are integrated just-in-time when they

are necessary

(9)

Cross business integration Improved efficiency

Closer customer relationships

Facilitation of just-in-time integration Complexity reduction

Legacy applications

(10)

Potential risk of security in exposing the application assets of an organization

XML support is inevitable

Cost of deploying the Web service technology is slightly high

(11)

<%@ WebService Language="C#" class="TestWS" %>

using System.Web.Services; class TestWS

{

[WebMethod]

public string SayHello(string name) {

return "Hello " + name; }

}

Save the file with asmx extension

Specifies that this asp page is a web service

Language in which the Web service is written Class containing Web methods

Import namespace

(12)

Methods using which a web service can be consumed are listed below:

HTTP-GET HTTP-POST SOAP

Using Web Service Proxies

(13)(14)

<html><body>

<p>Calling a web service using the POST method </p> <form name="form1" method="POST"

action="http://localhost/test1.asmx/SayHello"> <p> Enter your name :

<input type="text" name="name"> </p> <p> <input type="submit"> </p> </form> </body> </html>

(15)

Lightweight protocol used to exchange information in a decentralized, distributed computing environment

Helps to access objects, services, and servers in a platform independent way

Provides the extensibility required by HTTP with the help of XML

HTTP/XML based protocol that is capable of invoking a method with specific values

SOAP – Simple Object Access Protocol

(16)

Information about the web service, such as the methods it contains, and the parameters that need to be passed to these methods, are described through WSDL language

Based on XML

Uses tags to define attributes of the service

(17)

WSDL http://localhost/aspex/CH17/WebServiceDemo.asmx /n:FirstWS Web Service Proxies

The file TestWS.cs created is converted into a dll file using command:

(18)

<script language="C#" runat=server>

public void Page_Load(Object Sender, EventArgs e) {

FirstWS.TestWS WSObj = new FirstWS.TestWS(); Text1.Text = WSObj.SayHello("Scooby");

}

</script> <form>

<asp:TextBox id=Text1 runat=server/> </form>

(19)

UDDI is used to locate:

Information on Web services offered by a business partner List of providers for a particular Web service

Technical details about exposing a particular Web service Companies offering a particular Web service

Helps to register services provided by the service providers, so that they can be shared

Helps the service consumers or Web users to locate the Web services

(20)

UDDI API Schema

UDDI Services UDDI

Specifications (Business Registrations)

(21)

Summary 1-2

A service has two characteristics: Interface and Registration

 Web services reduce the “communication-gap” among the Web applications,

enhancing interactivity Web sites thereby group together to form a constellation, providing users with a rich user experience

 Advantages of Web Services

 Cross business integration  Improved efficiency

 Closer customer relationships

 Facilitation of just-in-time integration

 The extension of a Web service file in NET is .asmx

 The [WebMethod] tag notifies the ASP.NET compiler that the method to follow

should be a Web method, which is to be exported onto the Web

 A Web service could be called from a browser, an ASP page or even another

(22)

Summary 2-2

 WSDL is the short form for Web Services Description Language

WSDL is the grammar for a Web service, or moreover, could be thought of as a language that describes or portrays a Web service

 The proxy class does not contain any application logic Instead, it

contains the transporting logic as to how the parameters would be passed and the result retrieved

 The proxy class will also contain a list of all the methods that are

present in the Web service and their prototypes

 A proxy class can be created from any WSDL file

 UDDI is the abbreviation for Universal Description, Discovery and

Integration

 UDDI helps in registering the services provided by the service providers

Ngày đăng: 27/04/2021, 21:50

Xem thêm:

w