Download presentation
Presentation is loading. Please wait.
Published byFrode Ipsen Modified over 5 years ago
1
EGL / SOA – Concepts and Creating/Consuming Local Services
This Learning Module shows how to utilize the RBD tooling and EGL language to create and consume local services – that are part of a Service Oriented Architecture
2
RBD/EGL Programming Course Units: RBD and Course Setup RBD Workbench
EGL/Web QuickStart Programming in EGL Database and File Access EGL and Services (SOA) Calling External Languages From EGL EGL and Batch Applications Appendices
3
EGL and Services (SOA) Unit Topics: EGL and Services Overview
Creating and Consuming Local Services Setting up for Web Services Creating and consuming an EGL Web Service Consuming a 3rd Party Web Service
4
Course Title - Instructor Notes - Arial Narrow 20pt
The Promise of Services and SOA (Service Oriented Architecture) Services are the driving business system design paradigm of the day. Services – implemented in EGL provide a cross platform language for business oriented development Services and SOA are based on the concept of “Service Oriented Design” At development time… Focus on the business logic Implement SOA design elements: services and interfaces Leverage existing business developers for new SOA development Ignore deployment targets/technology while coding/testing Leverage external web services… EGL Interfaces Represent external web services Are created via import from WSDL Allow the EGL developer to stay within the context of the EGL programming model EGL SOA for WAS, CICS, System i Consume external services Deploy EGL services… To any platform Java to WAS/Tomcat/etc. COBOL to CICS, iSeries As… A Web service (uses SOAP) A private service (uses CICS ECI, J2C, or TCP) Other SOA runtimes when they reach critical mass W S D L External Web Service EGL Service EGL Interface EGL Records EGL Service Deploy Services as Web Services WSDL External Applications Module X - Module Title
5
Service Oriented Design – Concepts
Course Title - Instructor Notes - Arial Narrow 20pt Service Oriented Design – Concepts Service Orientated Design is a software design paradigm that encourages the creation of functionally discrete (modular) business logic, composed of standardized software components (logic routines and subroutines with standard interfaces) Services are software components that: Are logically separated, along the lines of a “business service” – such as: Rent a car – which is further de-composed into: Reserve a vehicle – consisting of lower-level services such as: Confirm a location Confirm the customer information Get payment information Confirm customer and payment information Create the reservation … Services are formally declared with a standard network interface that allows them to be invoked by other services that only know the interface. Also, services: May be created at various levels of business/technical granularity (i.e. low-level vs. high-level) Can be assembled/combined (“choreographed”) to create higher-level business functionality Can be deployed to any platform – independently – and called from any platform through their network interface Notes: Module X - Module Title
6
Network Interface (and More Services Concepts)
Course Title - Instructor Notes - Arial Narrow 20pt Network Interface (and More Services Concepts) “A Service is a network interface to programs that live on a particular machine implemented in such a manner that any other program (or many programs) running on any other machine, written in any language, and running on any OS can call it.” Bob Cancilla, IBM. Additionally: Services are an abstract design pattern - they are not the same as Web Services. In fact, a service can be implemented using a number of different technologies, including: RPC (Remote Program Call) - which you implement with an EGL: Local Service …or… Library call …or… Program DCOM (Distributed Component Object Model) REST (Representational State Transfer) CORBA (Common Object Request Broker) Web Services – which you implement with an EGL Service part The “network interface” for a Web Service is formally termed a WSDL Web Services Description Language Notes: The big issue of confusion is "how big" is a service? A service in concept is simple. It is just a function. It accepts input, performs some type of process, and returns output. INPUT--PROCESS-OUTPUT that is all that is going on. When does it make sense to create a Service? This is the 64,000 Question. In my initial view of Services, I looked at too low a level of detail and started decomposing functions that are better placed in an EGL Library as candidates for services. This is wrong and would kill a system's performance. We can and should use EGL Library functions to store reusable routines that are internal to an EGL application. The key to SOA is when you must leave the local machine and make a program available to other machines on throughout the private network or Internet. The twist on this occurs as IBM implements rich client. Since the client is a computer with full processing capabilities, it may be appropriate to implement business logic, database updates, etc. as services running on a central server but let all of the UI and controller logic reside on the desktop machine. The question here is how big is big or how small is small. The problem is there are no right or wrong answers here and the world is emerging. The bottom line is that SOA addresses a globally dispersed network of computers and functions both your own and those of your trading partners that must interoperate in order to support globalization and global supply chains as well as locally supporting merger and acquisition. Module X - Module Title
7
Creating and Consuming Services – WSDL Files and EGL Interfaces
Course Title - Instructor Notes - Arial Narrow 20pt Creating and Consuming Services – WSDL Files and EGL Interfaces WSDL is an XML document used to describe and locate Web Services. A WSDL: Specifies the run-time location as a URL Specifies operations and data in the Web Service Is written in XML using the SOAP transport protocol But you don’t want to: Learn XML or SOAP or… Create the WSDL files manually You want to code EGL business logic – exactly as you’ve done all along in this course So in fact, the RBD tooling will generate all of the “plumbing” for you – when you create or consume Web Services: When you create an EGL service, the tooling generates WSDL files, so you will not need to learn XML (and other low-level languages, terms and concepts) When you consume a service, RBD generates EGL Interfaces from existing WSDL files for you – automatically Notes: A protocol is a standard that designates the rules governing the syntax, semantic meaning, and synchronization of communication Actually – the most common standard of sending a WSDL is to use SOAP-HTTP, meaning to send over the HTTP protocol (over the internet) a document wrapped in a SOAP “envelope” – a message format. Module X - Module Title
8
EGL and Services Overview
Topic EGL and Services Overview Sub-Topics: EGL and Services Overview Creating and Consuming Local Services Setting up for Web Services Creating and consuming an EGL Web Service Consuming a 3rd Party Web Service
9
Course Title - Instructor Notes - Arial Narrow 20pt
A Simple EGL Service A service (Local or Web) is coded from the same basic EGL programming model you’ve used all along: package statement import statement(s) service <UniqueName> {optional properties} Global data (area) Functions – including a returns(type) on the signature Notes: Module X - Module Title
10
EGL Services – Steps for Creating and Consuming Local Services
Course Title - Instructor Notes - Arial Narrow 20pt EGL Services – Steps for Creating and Consuming Local Services Here are the high-level steps to create a Local Service. To create a local Service using EGL Code the service Generate the service (if not available) – Create a new services descriptor file Add the service as a local service Generate the descriptor file (if not done) Point to the services descriptor file, from the build-file To consume a local service from an EGL client 1. Code a variable of <serviceName> type in the client logic Add a Bindservice property with the appropriate bindkey (not shown, and optional if service binding name is the same as the service part name) serviceVar service1 2. Code the call to the ServiceVar.function(…) – passing parameters retCode int = serviceVar.nyTest(zipIn); Notes: Services are consumed (referenced and invoked) from “client” logic (other services, JSFHandlers, Libraries, and Programs. Module X - Module Title
11
EGL Local Services – Code the Service – 1 of 2
Course Title - Instructor Notes - Arial Narrow 20pt EGL Local Services – Code the Service – 1 of 2 A “Local Service” is an EGL Service that runs basically like a remote procedure call (RPC). However it IS a Service (EGL Service part) and can be generated into a Web Service with a WSDL without having to recode a single line. You’ve already created a service (in an earlier section of the course) – so let’s go add another Function to it From \EGLSource\services\ - open service1 in the content area. Add the following new function: Function name: nyTest Function parms: (zipIn char(5)) returns(int) Notes: Function logic: Suggestion: Use Content Assist to create the function logic Module X - Module Title
12
EGL Local Services – Code the Service – 2 of 2
Course Title - Instructor Notes - Arial Narrow 20pt EGL Local Services – Code the Service – 2 of 2 Still from within edit on service1 – add this custStateSearch function: Follow these steps to create this new service: Type the new function name and parms (use content assist for the tooling to automatically create the import statement for the Customer array) Inside the function, code: get customer; Right-click and using SQL Statement > Add, create an explicit SQL statement Add the where clause shown above Right-click and do a SQL Statement > Validate Save – Ctrl/S Generate – Ctrl/G Notes: Module X - Module Title
13
EGL Services – Create a Descriptor File and Add a Local Service
Course Title - Instructor Notes - Arial Narrow 20pt EGL Services – Create a Descriptor File and Add a Local Service Recall from one of the labs earlier in this course that you needed to add a new Services Descriptor file. You should already have done this – and its name is: EGLWeb.egldd You should already have added your service1 part as a LOCAL service. A Service Client Binding is basically a description of how your client applications (JSFHandlers, Programs, Library functions, Service Functions, etc.) call a Service. It names the Service Describes the calling protocol Etc. You should not have anything to do here – as long as you finished the Service Workshop earlier in the course. If you didn’t see the ***Notes section of this slide. Notes: A protocol is a convention (formal standard) that controls or enables the connection, communication, and data transfer between two computing endpoints. In its simplest form, a protocol can be defined as the rules governing the syntax, semantics, and synchronization of communication. To Do – If you didn’t already do so, from Project Explorer: Create a new Deployment Descriptor file, named: EGLWeb From the Service Client Bindings tab, Add a new EGL Binding Browse to find service1 (from Project Explorer) Right-click over EGLWeb.egldd – and Generate Module X - Module Title
14
EGL Services – Add the Service Descriptor to the Build-File
Course Title - Instructor Notes - Arial Narrow 20pt EGL Services – Add the Service Descriptor to the Build-File Recall from the previous workshop, that you must add a reference to your Service Descriptor file into your Project’s Build File From Project Explorer: Open batchBuildOptions.eglbld in the Content Area If not already set, from the ellipsis for the deploymentDescriptor entry, browse-to and select EGLWeb.egldd Save (press Ctrl/S) your changes and close the Build File Generate your Project You should now be ready to call the Service Notes: Module X - Module Title
15
EGL Services – Consume the Local Service
Course Title - Instructor Notes - Arial Narrow 20pt EGL Services – Consume the Local Service To consume a local service 1. Code a variable of <serviceName> type in the client logic 2a. Add a Bindservice property with the appropriate bindkey (see notes) 2. Code the call to the ServiceVar.function – passing parameters From Project Explorer, create a new EGL program in the \programs\ folder: Name: localServiceTest Add the following code (comments optional) to the main() function As you did in previous workshops, add a breakpoint next to an operational EGL instruction inside the function Press Ctrl/S (save) and Ctrl/G (generate) Notes: You will need property for your service. The Bindkey property is optional – and only necessary if your service name in the Service Client Bindings file, is different from the Service part name (ours is not – or shouldn’t be). Module X - Module Title
16
EGL Services – Debug Your Local Services
Course Title - Instructor Notes - Arial Narrow 20pt EGL Services – Debug Your Local Services From Project Explorer, right-click over localServiceTest.egl and select Debug EGL Program - Note that the Debugger allows you to step into the Service calls Notes: Module X - Module Title
17
Topic Summary Now that you have completed this topic, you should be able to: Create a Local Service and its functions Create a Services Descriptor file Add the Local Service to the Descriptor file’s client bindings Consume the Local Service Declare a variable of type service Call a service function Debug a Local Service Step through the code
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.