E N D
OGSI on Microsoft .NETDaragh Byrne, Ally Hume, Mike JacksonEPCChttp://www.epcc.ed.ac.uk/~ogsanetogsanet-queries@epcc.ed.ac.ukBudapest, Hungary – November 10th-11th 2003Some slides within this presentation have been graciously contributed by the OGSA-DAI project.Microsoft is a trademark of Microsoft Corporation.
Overview • MS.NETGrid Project • Web Services, OGSA and OGSI • OGSI on Microsoft .NET – MS.NETGrid-OGSI • Grid Service Demonstrators • Training Courses
Project Goals • Goals: • Engaging and training the UK e-Science community in OGSI and .NET • Facilitate uptake of .NET for developing Grid services • Achieve via delivery of: • Free-source OGSI implementation on .NET • Free-source Grid service demonstrators • Training materials • Training courses
Project Partners • EPCC: • Project management • Design, development and implementation • Authoring training materials • Delivering training courses • Microsoft Research Limited (Cambridge): • Technical consultancy and expertise • Provision of training materials • NeSC – UK National e-Science Centre: • Production and negotiation of collaboration agreement • Hosting training courses
OGSA-DAI e-Science Application e-Science Application OGSI and Microsoft .NET Course … … … … … OGSI and Microsoft .NET Course … … … … … OGSI and Microsoft .NET Course … … … … … OGSI and Microsoft .NET Course … … … … … Project Activities OGSI Microsoft .NET
Web Services • Network-enabled application • Exposes a well-defined interface • Stateless: • Born • Services Request • Dies • Accessible using common Internet protocols • HTTP • XML-oriented technology: • Describe services and their interfaces • WSDL – Web Services Description Language • Support messaging • SOAP – Simple Object Access Protocol
WSDL • Web Services Description Language • XML description of Web Services: • Define input and outputmessages • Define operations in terms of input and output messages • Aggregate operations into portTypes • Application-specific collections of related operations • Combine portTypes with a concrete network protocol and message format to form a binding • Combine a binding and a network address to define a concretenetwork endpoint or port • Aggregate 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: • Dynamic • Transient • Stateful – have a finite lifetime • Defined by a well-defined set of interfaces and behaviours • More information from • http://forge.gridforge.org
OGSA Characteristics • Supports: • Resource access • Resources sharing • Service integration • Uniform 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 Infrastructure • Minimum set of standards and behaviours with which Grid Services must comply • Exploits existing Web Services properties: • Interface abstraction via WSDL portTypes • Web Service protocols • Hosting platform-independent • Extends these to provide for: • State management • Event notification • Service location and access • Lifecycle management • Service data • More information from: • http://forge.gridforge.org
Service Creation • Service Grouping • Notification • Handle Resolution • Other functions e.g: • Workflow • Auditing • Resource Management • Service Data Access • Lifetime Management Handle Anatomy of a Grid Service GridService portType (required) Other PortTypes (Optional) Grid Service Service Data Element Element Element Hosting Environment
Service Creation • Service Grouping • Notification • Handle Resolution • Other functions e.g: • Workflow • Auditing • Resource Management • Service Data Access • Lifetime Management Handle Anatomy of a Grid Service GridService portType (required) Other PortTypes (Optional) Element Service Data Set Element Element Implementation Hosting Environment
Service Creation • Service Grouping • Notification • Handle Resolution • Other functions e.g: • Workflow • Auditing • Resource Management • Service Data Access • Lifetime Management Handle Anatomy of a Grid Service GridService portType (required) Other PortTypes (Optional) Service Data Service Data Service Data Implementation Hosting Environment
OGSI PortTypes (1) • GridService • findServiceData • setServiceData • requestTerminationBefore • requestTerminationAfter • destroy • Factory • createService • HandleResolver • findByHandle • ServiceGroup
OGSI PortTypes (2) • ServiceGroupRegistration • add • remove • ServiceGroupEntry • NotificationSource • subscribe • NotificationSubscription • NotificationSink • deliverNotification
WSDL and GWSDL • WSDL 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 inheritance • Open content model • Stepping stone to WSDL 1.2 • GWSDL => WSDL 1.1: • Flattening the inheritance hierarchy • The “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 the • Grid Service Reference (GSR) that is unique to an instance of a Grid Service • A 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.1 • University of Virginia: OGSI.NET Release 1.1 • Java: • Globus: Globus Toolkit 3 Release 1.0 • Unicore • Perl: • University of Manchester: OGSI::Lite • Python: • Lawrence Berkley National Labs: pyGlobus
Design Dimensions • Use IIS/ASP.NET: • Facilitate speed of development • SOAP and WSDL handling for free! • Industry-standard Web services programming model • Maintain integration with existing technology • Exploit existing knowledge of developers • Utilise .NET class library • Rich 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 support • But Grid services ARE Web services! • GSH / GSR support • Subset of OGSI portTypes • Security • But can secure using ASP.NET Web Services Security • No GWSDL
MS.NETGrid-OGSI • Implementation of OGSI on Microsoft .NET • Leverages ASP.NET functionality • Provides support for: • Grid service hosting in ASP.NET Web services container • GridService portType-related functionality • Factory portType-related functionality • Service data management • Management of persistent and transient services
8. C# method return C# Implementation 1. C# method call 7. SOAP response 2. SOAP request 6. Operation Return 4. Grid Service Object Reference 3. Grid Service ID 5. Operation Call C# Implementation Client-Service Interaction Client Proxy (from WSDL) HTTP ASP.NET Web Service Proxy (.asmx) OGSI Container Grid Service Grid Service Grid Service
Service Lifetime and Naming • Persistent services: • Server-managed services • Necessary for factories, permanent services • Naming • http://host/Ogsi.Container/services/persistent/SomeServiceFactory.asmx • Transient services: • Client-managed services • Naming • http://host/Ogsi.Container/services/transient/SomeService.asmx?instanceID=someService1
Service Proxy Model • Service proxy is standard ASP.NET Web service • Created – processes request - dies • Communications layer between client and Grid services: • One proxy type corresponds to one or more Grid services • One instance of a proxy created per service request to .asmx file • GSH is used by proxy to find Grid service object • Reflection allows invocation of a service method on that object • Operations exposed via WebMethod attributes • SOAP communication and WSDL description for free! • Familiar model to ASP.NET users • Potential for auto-generation of proxy code
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 OR • PersistentGridServiceSkeleton-derived • PortTypeProviders for portTypes • Provide a service proxy class: • Communications layer between clients and services • No original effort required! • Represents the most-derived portType • Inherits from GridServiceInstanceAspProxy (which derives from ASP.NET classWebService) • Deploy the service: • ASP.NET Web service deployment descriptor (Web.config) • Location of classes and proxies / service lifetime type • Application-specific information
MS.NETGrid-OGSI Classes • Inherit from: • GridServiceSkeleton • OR • PersistentGridServiceSkeleton • 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 instance • ServiceDataSetandServiceData 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 method public 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 created • Store 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 class • Recommended when only one portType is required • Quick and convenient • Option 2 – PortType Providers: • Use IPortTypeProvider implementations • Use OgsiPortType attribute to associate with service class • PortTypeProviders property of GridServiceSkeleton • Maps requests to IPortTypeProviderinstances • 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 instance • Custom initialisation code – called after the IPortTypeProvider is created • Attach to service with OgsiPortTypeAttribute • PortTypeProviderBasegives simple implementation of PortTypeProvider
How PortType Providers Work • Attributes and reflection! • On instantiation of GridServiceSkeleton: • Reflects upon self to get OgsiPortType attributes • Uses the information in the attributes to instantiate implementation classes [OgsiPortType(typeof(HelloPortType), “http://mydomain.com/NameSpace”, “HelloPortType”] • Stores instances in PortTypeProviders hashtable • Methods 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 type • ServiceDataSet 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 [ ]) • Callbackproperty for on-demand generation • Uses IServiceDataValuesCallback
Service Proxies • Communications layer between clients and Grid service objects • Proxies are Web services • Based on System.Web.Services.WebService class of ASP.NET • Allows ASP.NET to forward service requests to/from Grid service objects: • GridServiceInstanceAspProxy • and • PersistentGridServiceInstanceAspProxy
Proxies and Inheritance // HelloService.cspublic 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 container • CallMethod 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"%>
Deployment Descriptors and ASP.NET Web.Config • gridContainer element • Add gridServiceDeploymentDescriptor: <gridServiceDeploymentDescriptorasmxFileName=“HelloService.asmx”serviceClass=“HelloServiceImpl”assembly=“HelloAssembly”persistence=“persistent”><serviceParameter name=“key” value=“value”/> </gridServiceDeploymentDescriptor> • Attributes: • asmxFileName - .asmx file for proxy • service – main service implementation class • assembly - service and proxy assembly • persistence - transient or persistent
Provide the Service • Copy assemblies to Ogsi.Container/bin/ directory • Copy .asmx file to: • services/persistent directory • OR • services/transient directory
Grid Service Demonstrators • Representative examples provided with the MS.NETGrid-OGSI distribution • Basic GridService: • Implements GridServiceportType • Persistent and transient services available, with factory • Counter Service: • A simple transient counter service which maintains state • An associated persistent factory service • A client with a graphical user-interface