Overview

Post on 25-Jan-2016

16 views 0 download

Tags:

description

- PowerPoint PPT Presentation

Transcript of Overview

OGSI on Microsoft .NET

Daragh Byrne, Ally Hume, Mike Jackson

EPCC

http://www.epcc.ed.ac.uk/~ogsanetogsanet-queries@epcc.ed.ac.uk

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.

Overview

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

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

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

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…

… … … …

Web Services, OGSA and OGSI

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

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

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

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

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

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

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)

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

OGSI PortTypes (1)

GridServicefindServiceDatasetServiceDatarequestTerminationBeforerequestTerminationAfterdestroy

FactorycreateService

HandleResolverfindByHandle

ServiceGroup

OGSI PortTypes (2)

ServiceGroupRegistrationaddremove

ServiceGroupEntryNotificationSource

subscribe

NotificationSubscriptionNotificationSink

deliverNotification

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

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

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

OGSI on Microsoft .NET

MS.NETGrid-OGSI

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

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

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

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

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

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

Developing a Grid Service

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!

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

Implement the Service Functionality

MS.NETGrid-OGSI Classes

Inherit from:GridServiceSkeleton ORPersistentGridServiceSkeleton

Hello Service:

public class HelloServiceImpl : PersistentGridServiceSkeleton

{ . . . . . . . . .}

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

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

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

Inheritance

public class HelloServiceImpl : PersistentGridServiceSkeleton

{int i = 0;

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

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

}

}

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{}

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

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

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

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

Provide a Service Proxy Class

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

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

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); }}

Completing the Proxy

Write .asmx file which references proxy type

<%@ WebService Class=“HelloService"%>

Deploy the Service

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

Provide the Service

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

services/persistent directoryORservices/transient directory

Grid Service Demonstrators

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

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)

OGSA-DAI Grid Data Service (2)

Training the UK e-Science Community

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

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

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

Course Outline – Day 2RecapDeveloping a Grid Service 1

PracticalDeveloping a Grid Service 2

PracticalDeveloping a Grid Service 3

PracticalMiscellaneous:

MS.NETGrid-OGSI DemonstratorsCourse FeedbackDiscussion

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