Overview

58
OGSI on Microsoft .NET Daragh Byrne, Ally Hume, Mike Jackson EPCC http://www.epcc.ed.ac.uk/~ogsanet [email protected] Budapest, Hungary – November 10 th -11 th 2003 Some slides within this presentation have been graciously contributed by the OGSA- DAI project. Microsoft is a trademark of Microsoft Corporation.

description

- PowerPoint PPT Presentation

Transcript of Overview

Page 1: Overview

OGSI on Microsoft .NET

Daragh Byrne, Ally Hume, Mike Jackson

EPCC

http://www.epcc.ed.ac.uk/[email protected]

Budapest, Hungary – November 10th-11th 2003

Some slides within this presentation have been graciously contributed by the OGSA-DAI project.

Microsoft is a trademark of Microsoft Corporation.

Page 2: Overview

Overview

MS.NETGrid ProjectWeb Services, OGSA and OGSIOGSI on Microsoft .NET – MS.NETGrid-OGSIGrid Service Demonstrators Training Courses

Page 3: Overview

Project Goals

Goals:Engaging and training the UK e-Science community in OGSI and .NETFacilitate uptake of .NET for developing Grid services

Achieve via delivery of:Free-source OGSI implementation on .NETFree-source Grid service demonstratorsTraining materialsTraining courses

Page 4: Overview

Project Partners

EPCC:Project managementDesign, development and implementationAuthoring training materialsDelivering training courses

Microsoft Research Limited (Cambridge):Technical consultancy and expertiseProvision of training materials

NeSC – UK National e-Science Centre:Production and negotiation of collaboration agreementHosting training courses

Page 5: Overview

Project Activities

Microsoft .NET

OGSI

OGSA-DAI

e-Science Application

e-Science Application

OGSI andMicrosoft .NET

Course…

… … … …

OGSI andMicrosoft .NET

Course…

… … … …

OGSI andMicrosoft .NET

Course…

… … … …

OGSI andMicrosoft .NET

Course…

… … … …

Page 6: Overview

Web Services, OGSA and OGSI

Page 7: Overview

Web ServicesNetwork-enabled applicationExposes a well-defined interfaceStateless:

BornServices RequestDies

Accessible using common Internet protocolsHTTP

XML-oriented technology:Describe services and their interfaces

WSDL – Web Services Description Language

Support messaging SOAP – Simple Object Access Protocol

Page 8: Overview

WSDL

Web Services Description LanguageXML description of Web Services:

Define input and output messagesDefine operations in terms of input and output messagesAggregate operations into portTypes

Application-specific collections of related operations

Combine portTypes with a concrete network protocol and message format to form a bindingCombine a binding and a network address to define a concrete network endpoint or portAggregate ports into an abstract network endpoint or service

Current W3C version is 1.1

Page 9: Overview

What is OGSA?

Open Grid Services Architecture

Open Grid Architecture + Web Services = Grid Services

Grid Services:DynamicTransientStateful – have a finite lifetimeDefined by a well-defined set of interfaces and behaviours

More information fromhttp://forge.gridforge.org

Page 10: Overview

OGSA CharacteristicsSupports:

Resource accessResources sharingService integrationUniform access to services

Specifies protocols and standards that:Are:

Implementation-independent Platform-independent

Support: Communication Data access, transfer, translation and transformation Access and security Auditing and logging

Page 11: Overview

What is OGSI?Open Grid Services InfrastructureMinimum set of standards and behaviours with which Grid Services must comply Exploits existing Web Services properties:

Interface abstraction via WSDL portTypesWeb Service protocolsHosting platform-independent

Extends these to provide for:State managementEvent notificationService location and accessLifecycle managementService data

More information from:http://forge.gridforge.org

Page 12: Overview

Anatomy of a Grid Service

Hosting Environment

•Service Data Access•Lifetime Management

GridService portType(required)

Other PortTypes(Optional)

•Service Creation•Service Grouping•Notification•Handle Resolution

•Other functions e.g:•Workflow•Auditing•Resource Management

ElementElement

ElementService Data

Grid ServiceHandleHandle

Page 13: Overview

Anatomy of a Grid Service

Hosting Environment

Implementation

•Service Data Access•Lifetime Management

Other PortTypes(Optional)

•Service Creation•Service Grouping•Notification•Handle Resolution

•Other functions e.g:•Workflow•Auditing•Resource Management

ElementElement

ElementService Data SetHandleHandle

GridService portType(required)

Page 14: Overview

Anatomy of a Grid Service

Hosting Environment

Implementation

•Service Data Access•Lifetime Management

Other PortTypes(Optional)

•Service Creation•Service Grouping•Notification•Handle Resolution

•Other functions e.g:•Workflow•Auditing•Resource Management

Service DataHandleHandle

GridService portType(required)

Service DataService Data

Page 15: Overview

OGSI PortTypes (1)

GridServicefindServiceDatasetServiceDatarequestTerminationBeforerequestTerminationAfterdestroy

FactorycreateService

HandleResolverfindByHandle

ServiceGroup

Page 16: Overview

OGSI PortTypes (2)

ServiceGroupRegistrationaddremove

ServiceGroupEntryNotificationSource

subscribe

NotificationSubscriptionNotificationSink

deliverNotification

Page 17: Overview

WSDL and GWSDLWSDL 1.1:

Lack of portType inheritance A portType cannot be defined in terms of an aggregation or

extension of one or more other portTypes

Lack of an open content model Needed for specifying service data

GWSDL:portType inheritanceOpen content modelStepping stone to WSDL 1.2

GWSDL => WSDL 1.1:Flattening the inheritance hierarchyThe “most-derived” portType

WSDL 1.2

Page 18: Overview

Grid Service Identification

Grid Services are identified by means of a

Grid Service Handle (GSH), which is used to find theGrid Service Reference (GSR) that is unique to an instance of a Grid ServiceA HandleResolver service is used to provide a GSR given a GSH

GSH:Type of URI (or URL)Constant for the lifetime of the Grid Service

GSR:Representation of the service interfaces

Can be a WSDL document

Can change if the service evolves

Page 19: Overview

OGSI Implementations

Microsoft .NET:EPCC: MS.NETGridOGSI Release 1.1University of Virginia: OGSI.NET Release 1.1

Java:Globus: Globus Toolkit 3 Release 1.0Unicore

Perl:University of Manchester: OGSI::Lite

Python:Lawrence Berkley National Labs: pyGlobus

Page 20: Overview

OGSI on Microsoft .NET

MS.NETGrid-OGSI

Page 21: Overview

Design Dimensions

Use IIS/ASP.NET:Facilitate speed of development

SOAP and WSDL handling for free!

Industry-standard Web services programming modelMaintain integration with existing technologyExploit existing knowledge of developers

Utilise .NET class libraryRich framework for XML programming, serialization etc.

Use an object instance to represent a service instance

Creating service object and loading state every request is too costly:

Performance-wise Development time-wise

Page 22: Overview

Design Limitations

No rich client-side support:No Grid service-specific supportBut Grid services ARE Web services!

GSH / GSR supportSubset of OGSI portTypesSecurity

But can secure using ASP.NET Web Services Security

No GWSDL

Page 23: Overview

MS.NETGrid-OGSI

Implementation of OGSI on Microsoft .NETLeverages ASP.NET functionalityProvides support for:

Grid service hosting in ASP.NET Web services containerGridService portType-related functionalityFactory portType-related functionalityService data managementManagement of persistent and transient services

Page 24: Overview

C#Implementation

ASP.NET

Client-Service Interaction

C#Implementation Client

Proxy(from WSDL)

Proxy(from WSDL)

8. C# method return

1. C# method call

HTTP

2. SOAP request 7. SOAP response

OGSI Container

Grid ServiceGrid

Service

Grid ServiceGrid

Service

Grid ServiceGrid

Service

Web Service Proxy (.asmx)Web Service Proxy (.asmx)

4. Grid Service Object

Reference3. Grid Service

ID

5. Operation

Call

6. Operation

Return

Page 25: Overview

Service Lifetime and Naming

Persistent services:Server-managed servicesNecessary for factories, permanent servicesNaming

http://host/Ogsi.Container/services/persistent/SomeServiceFactory.asmx

Transient services:Client-managed servicesNaming

http://host/Ogsi.Container/services/transient/SomeService.asmx?instanceID=someService1

Page 26: Overview

Service Proxy Model

Service proxy is standard ASP.NET Web serviceCreated – processes request - dies

Communications layer between client and Grid services:

One proxy type corresponds to one or more Grid servicesOne instance of a proxy created per service request to .asmx fileGSH is used by proxy to find Grid service objectReflection allows invocation of a service method on that objectOperations exposed via WebMethod attributes

SOAP communication and WSDL description for free!Familiar model to ASP.NET usersPotential for auto-generation of proxy code

Page 27: Overview

Developing a Grid Service

Page 28: Overview

Grid Service Design

What services will your Grid service provide?What operations will it support?How are these operations aggregated into portTypes?What existing and new portTypes will your service implement?No need to write WSDL!

Page 29: Overview

Grid Service Development

Implement the service functionality:GridServiceSkeleton-derived ORPersistentGridServiceSkeleton-derivedPortTypeProviders for portTypes

Provide a service proxy class:Communications layer between clients and servicesNo original effort required!Represents the most-derived portTypeInherits from GridServiceInstanceAspProxy (which derives from ASP.NET class WebService)

Deploy the service:ASP.NET Web service deployment descriptor (Web.config)Location of classes and proxies / service lifetime typeApplication-specific information

Page 30: Overview

Implement the Service Functionality

Page 31: Overview

MS.NETGrid-OGSI Classes

Inherit from:GridServiceSkeleton ORPersistentGridServiceSkeleton

Hello Service:

public class HelloServiceImpl : PersistentGridServiceSkeleton

{ . . . . . . . . .}

Page 32: Overview

GridServiceSkeleton (1)

Implements GridService portType functionality:

findServiceData, setServiceData, requestTerminationBefore, requestTerminationAfter, destroy

InstanceServiceDataSet property:ServiceDataSet for the live running service instanceServiceDataSet and ServiceData APIs

ServiceParameters property:General purpose hashtable Loaded with configuration data from a deployment descriptor when service is initialised

PortTypeProviders property:Hashtable containing references to implementations of portTypes

Page 33: Overview

GridServiceSkeleton (2)

PostCreate methodpublic abstract class GridServiceSkeleton

{

public virtual void PostCreate(){}

}

Can be used for resource acquisition, service data initialisation, other initialisation:

Called by the container or factory when service is createdStore useful items in ServiceParameters hashtable

Only for objects used by all the portTypes of a service

Page 34: Overview

Implementing PortType Operations

Option 1 - Inheritance: Provide methods on a GridServiceSkeleton-derived classRecommended when only one portType is requiredQuick and convenient

Option 2 – PortType Providers:Use IPortTypeProvider implementationsUse OgsiPortType attribute to associate with service class PortTypeProviders property of GridServiceSkeleton

Maps requests to IPortTypeProvider instances

Modularises portType and service implementations

Page 35: Overview

Inheritance

public class HelloServiceImpl : PersistentGridServiceSkeleton

{int i = 0;

// sayHello is an operation on some portType public string sayHello(string name)

{ return “Hello, “ + name + “ “ + (++i);

}

}

Page 36: Overview

PortType Providers (1)

public class HelloPortType : PortTypeProviderBase{ int i = 0;

public string sayHello(string name){ return “Hello, “ + name + “ “ + (++i);}

public override void Initialise() { }}

// Declare service and attach portType using attribute[OgsiPortType(typeof(HelloPortType),

“http://mydomain.com/NameSpace”, “HelloPortType”]public class HelloServiceImpl :

PersistentGridServiceSkeleton{}

Page 37: Overview

PortType Providers (2)public interface IPortTypeProvider {

GridServiceSkeleton ServiceInstance { get;

set; } void Initialise();

}

Provides for:Access to service instanceCustom initialisation code – called after the IPortTypeProvider is created

Attach to service with OgsiPortTypeAttributePortTypeProviderBase gives simple implementation of PortTypeProvider

Page 38: Overview

How PortType Providers Work

Attributes and reflection!On instantiation of GridServiceSkeleton:

Reflects upon self to get OgsiPortType attributesUses the information in the attributes to instantiate implementation classes

[OgsiPortType(typeof(HelloPortType), “http://mydomain.com/NameSpace”, “HelloPortType”]

Stores instances in PortTypeProviders hashtableMethods can then be called on these instances

Page 39: Overview

Service Data

Named like any XML element:(namespace, local name)

Represented by an instance of the Ogsi.ServiceData.ServiceData typeServiceDataSet type represents the entire collection of service data for a service

GridServiceSkeleton.InstanceServiceData

Page 40: Overview

Service Data APIs

ServiceDataSet:Create(XmlQualifiedName name);Add(ServiceData data);Contains(XmlQualifiedName name);Delete(XmlQualifiedName name);

Remove(XmlQualifiedName name);

ServiceData:Contains System.Object(s)GetValues() / GetValuesArray()

Value property

SetValues(object [ ])

Callback property for on-demand generation Uses IServiceDataValuesCallback

Page 41: Overview

Provide a Service Proxy Class

Page 42: Overview

Service Proxies

Communications layer between clients and Grid service objectsProxies are Web servicesBased on System.Web.Services.WebService class of ASP.NETAllows ASP.NET to forward service requests to/from Grid service objects:

GridServiceInstanceAspProxy

andPersistentGridServiceInstanceAspProxy

Page 43: Overview

Proxies and Inheritance // HelloService.cs

public class HelloService : PersistentGridServiceInstanceAspProxy{ [WebMethod] // Any other ASP.NET attributes public string SayHello(string name) { object [] args = { name }; return (string) CallMethod(“SayHello”, args); }}

GridServiceInstanceAspProxy / PersistentGridServiceInstanceAspProxy constructor provides reference to service instance object via containerCallMethod invokes on service instance object

Page 44: Overview

Proxies and PortType Providers

// HelloService.cspublic class HelloService :

PersistentGridServiceInstanceAspProxy { [WebMethod] // Any other ASP.NET attributes public string SayHello(string name) { object [] args = { name }; return (string)

CallMethodOnProvider(“HelloPortType”,

“SayHello”, args); }}

Page 45: Overview

Completing the Proxy

Write .asmx file which references proxy type

<%@ WebService Class=“HelloService"%>

Page 46: Overview

Deploy the Service

Page 47: Overview

Deployment Descriptors and ASP.NET Web.Config

gridContainer elementAdd gridServiceDeploymentDescriptor:

<gridServiceDeploymentDescriptorasmxFileName=“HelloService.asmx”serviceClass=“HelloServiceImpl”assembly=“HelloAssembly”persistence=“persistent”><serviceParameter name=“key” value=“value”/>

</gridServiceDeploymentDescriptor>

Attributes:asmxFileName - .asmx file for proxyservice – main service implementation class assembly - service and proxy assemblypersistence - transient or persistent

Page 48: Overview

Provide the Service

Copy assemblies to Ogsi.Container/bin/ directoryCopy .asmx file to:

services/persistent directoryORservices/transient directory

Page 49: Overview

Grid Service Demonstrators

Page 50: Overview

Grid Service Demonstrators

Representative examples provided with the MS.NETGrid-OGSI distributionBasic GridService:

Implements GridService portTypePersistent and transient services available, with factory

Counter Service:A simple transient counter service which maintains stateAn associated persistent factory serviceA client with a graphical user-interface

Page 51: Overview

Open Grid Services Architecture – Data Access and Integration

http://www.ogsadai.org.uk

Stripped down from full OGSA-DAI functionalityService-database communication over ADO.NET

OGSA-DAI Grid Data Service (1)

Grid Data Service SQL Server

Client

Request (GDS-Perform document)

Response(GDS-Response document)

(WebRowSet)

Page 52: Overview

OGSA-DAI Grid Data Service (2)

Page 53: Overview

Training the UK e-Science Community

Page 54: Overview

Training Courses

“OGSI on Microsoft .NET”Designed for UK e-ScientistsFour courses each for 25 attendees:

September 9th-10th 2003November 4th-5th 2003January 27th-28th 2004February 2004

e-Science Institute in Edinburghhttp://www.nesc.ac.uk/esi

Page 55: Overview

Course Goals

Introduce / review:Grid ServicesMicrosoft .NET

Introduce OGSI on Microsoft .NETMS.NETGrid-OGSI

Use MS.NETGrid-OGSI:Develop a Grid ServiceDevelop a client

Introduce related OGSI on Microsoft.NET work

Page 56: Overview

Course Outline – Day 1

Welcome and Workshop OverviewGrid Services

Web Services and XMLGrids, OGSA and OGSI

Essential Microsoft .NET Concepts

.NET Framework OverviewC# Recap, Assemblies and Using MetadataASP.NET

OGSI and .NET

Why OGSI on .NET?MS.NETGrid-OGSI

Obtaining, installing and testing MS.NETGrid-OGSI

Practical

Page 57: Overview

Course Outline – Day 2RecapDeveloping a Grid Service 1

PracticalDeveloping a Grid Service 2

PracticalDeveloping a Grid Service 3

PracticalMiscellaneous:

MS.NETGrid-OGSI DemonstratorsCourse FeedbackDiscussion

Page 58: Overview

Near Future

Revision of OGSI on .NET containerFacilitating scalability and service persistence

Development of additional Grid service demonstrators:

Practical demonstration of the utility of OGSI on .NET

Revision of training materials:Courses and supporting materials on OGSI and .NET

Delivery of additional courses