860 likes | 1.6k Views
Web Services and SOA for the RPG Developer on IBM i IBM Integrated Web services for i. Dan Hiebert IBM dhiebert@us.ibm.com. Agenda. Introduction to SOA & Web Services Creating RPG Web Service Business Logic. Deploying/Testing RPG Web Services. Consumption of Web Services.
E N D
Web Services and SOA for the RPG Developer on IBM iIBM Integrated Web services for i Dan Hiebert IBM dhiebert@us.ibm.com
Agenda • Introduction to SOA & Web Services • Creating RPG Web Service Business Logic. • Deploying/Testing RPG Web Services. • Consumption of Web Services. • Presentation Layer of Web Services.
Introduction SOA & Web Serviceson IBM i Introduction to SOA & Web Services • IBM i Project for Web services • Introduction Web Services and SOA technology's
Web Services Made Easy – An IBM i Project • IBM Integrated Web Services for i • “An Easy Step to starting with SOA on System i” • Simplify the process of externalizing RPG/COBOL business logic as a service. • Externalize various RPG/COBOL business tasks as services. • Abstracts the hidden complexities of Web services for IBM i. • Provide RPG/COBOL Developer easy to use Web interface, not requiring additional tools or skills http://www.ibm.com/systems/i/software/iws/
IBM Integrated Web services server for i • Merged the Development Process and Deployment Server • 2 Steps to Create a Web services server on IBM i • 7 Steps to Deploy an RPG/COBOL Service • Built on IBM Integrated Web Application Server for I • Note: 2 Methods returned for every procedure or program • XML - Automated Data (Including Data Structures) • Standard Serialized objects. • Embedded Axis 2 Engine into IBM i (5722SS1)
What is …..? … a service? A repeatable business task – e.g., check customer credit; open new account … service oriented architecture (SOA)? An IT architectural style that supports integrating your business as linked services "SOA impacts every aspect of IT and business.”
Web Service Definition (from the Wikipedia.com) “A 'Web service' (also Web Service) is defined by the W3C as "a software system designed to support interoperablemachine-to-machine interaction over a network"[1]. Web services are frequently just WebAPIs that can be accessed over a network, such as the Internet, and executed on a remote system hosting the requested services.”
What Are They? • Web services • Applications that are invoked over the Web • An implementation of Service Oriented Architecture (SOA) • Contain only business logic, do not have a user interface • Self-contained • Self-describing
Requirements Addressed By Web Services • Interoperability – need a common communication protocol • Between systems • Between languages • Interface Description Language • Describe the service’s interface • Clear and unambiguous • Platform independent • Retrieval of Service • Search and retrieve available services • Conventient integration at design time and runtime • Security • Protection of services • Protection of data sent to/from services
Types of Web Services • Business Information: access to a database or rapidly changing contents • Stock quotes • Currency conversion rates • Address book • Geographical data • Business Integration: implementing a function or outsourcing a business process • Reservations system • Credit check • Payment system • Loan service • Product catalog
Web Services Overview Definition: Self-Contained with well-defined interfaces that provide functionality that is accessible over the Internet/Intranet Key Technologies: XML, WSDL, SOAP, UDDI
Web Service Participants • Provider: implements a Web service • Requestor: has a business need • Broker: lists all available services Broker 2 1 publish find 3 bind/invoke Requestor Provider
Web Services Technology Stack Discovery UDDI, WSIL Description WSDL XML Messaging SOAP Transport HTTP, JMS, FTP, SMTP
What is …..? … a service? A repeatable business task – e.g., check customer credit; open new account … service oriented architecture (SOA)? An IT architectural style that supports integrating your business as linked services "SOA impacts every aspect of IT and business.”
SOA Is Like Musical Notes… Each musical notes represents a business service Checking Inventory Tracking Shipment Checking Credit Placing an Order Opening Account SOA allows for flexible composition of music
Interface Interface Service Application = = = = Web services are a good start… Turn this … …into this (web services). Service Service Service Service Service Service Service • Rich business abstractions describe the application interface • Decouples the interfaces from the business applications • The number and complexity of the interfaces is reduced • Business applications and their interfaces become reusable
Resources • Integrated Web Services for IBM i • http://www.ibm.com/systems/i/software/iws/ • IBM Technical Information and Example • http://www.ibm.com/developerworks/ • WebSphere Enterprise Service Bus • http://www-306.ibm.com/software/integration/wsesb/ • WebSphere Process Server • http://www-306.ibm.com/software/integration/wps/
Creating RPG Web Service Business Logic Web Services and SOA for the RPG Developer on IBM i Dan Hiebert IBM dhiebert@us.ibm.com
Agenda • Introduction to SOA & Web Services • Creating RPG Web Service Business Logic. • Lab Time • Consumption of Web Services. • Lab Time • Deploying/Testing RPG Web Services. • Lab Time • Presentation Layer of Web Services. • Lab Time
Creating RPG Web Service Business Logic • ILE RPG Best Programming Practices • RPG Style Web Service • Encapsulated • Reusable • Stateless • Event driven • Loosely coupled • RPG Traditional vs Modular - Example
RPG Developer – Misconceptions • The RPG language is outdated and does not work with the Web Services paradigm. • I need to modernize my “Monolithic” application. • I have to re-write my entire application to code for RPG Web Services.
RPG Best Practices – Quick Reference • Use Free Form • Utilize ILE Techniques • Procedures • Binding Directories • Service Programs • Exports – Hints & Tips • Centralize Declarations • Expand Naming Conventions • Write Indicatorless Code • Use Structured Programming Techniques • Use Comments • Avoid Obsolescence
What is a Service? • Function • Get information • Perform action • Properties • Encapsulated • Reusable • Stateless • Event driven • Loosely coupled • Modular
Procedure Typed parameters Input only Value Const Both input and output Return value Local variables Only accessible in procedure No side effects Subroutine Global variables All can be modified Global variables Accessible outside procedure Side effects Implementing Encapsulation
Reusability • Design from business perspective • What is the business function provided • Not based on implementation • Design for future enhancements • Based on what business function should do • Not based on current limits • Input checking • Do not trust interface user • Provide meaningful error messages
Stateless • State is kept by service user • Data necessary for request is provided • Response must contain appropriate data for follow-on requests • Service may be called by many different users • Ensure no data carryover • Pragmatism • If service will be heavily used with persistent connection: • Caching of state my improve performance • Request data overrules use of cached data • Caution: On RPG Record access to DB – Do not necessarily expect maintained, especially with “1 to M” users.
Event Driven • Service does not assume any particular order • Requests drive service • Allows new uses for service • Problems if data is locked between requests • Service processes request • Validity checks • Perform operations • Sends response • Frees resources
Loosely Coupled • Positive • Increased flexibility • More responsive to business changes • More responsive to technology changes • Code maintenance • Negative • More computationally expensive • Higher latency • More parts
Service Encapsulated Access through interface Reusable Write once – use everywhere Stateless Information not retained Event driven No required order Loosely coupled Callable from anywhere Traditional Global data Access directly Reuse by copy Maintain everywhere Stateful Information retained in job Application driven Fixed order Tightly coupled Tied to application Properties Comparison Review – Service
RPG – Traditional vs. Modular Example A Simple Rewrite example for RPG Procedures
RPG Modular Business Logic
Deploy RPG Web Service Business Logic Web Services and SOA for the RPG Developer on IBM i Dan Hiebert IBM dhiebert@us.ibm.com
Agenda • Introduction to SOA & Web Services • Creating RPG Web Service Business Logic. • Lab Time • Deploying/Testing RPG Web Services. • Lab Time • Consumption of Web Services. • Lab Time • Presentation Layer of Web Services. • Lab Time
Deploy RPG Web ServiceBusiness Logic • Introducing – IBM Web Services Server on i • Recent Enhancements • Embedding WS information in Program/Service Program • Demo – WS-Server (that easy) • Deep Dive & Scripts
Introducing - IBM Integrated Web Services Server on i Key Features of IBM I Web Services server • Integrated into IBM i • WS-Basic Profile – Compliant • Developed for RPG/COBOL • Open Source Technology • Removes Complexities of Web Services for IBM i Developer • Easy to Use - Web Admin Interface • IBM i Web Services Test Client • Externalizes IBM i Program Objects • Tracing – WS-Message & Program Objects • Scripting Support
Example: RPG Find Customer RPG Find Customer
Binding RPG Business Logic to Program/Service Program • Service Info embedded with RPG or COBOL program objects (PCML) • For V6R1 need to recompile specifying:CRTRPGMOD PGMINFO(*PCML *MODULE) CRTCBLMOD PGMINFO(*PCML *MODULE) • For V5R4 – recompile specifying following option in the source: • For RPG H PGMINFO(*PCML:*MODULE) • For COBOLPROCESS OPTIONS PGMINFO(PCML MODULE) • Service Information can alternatively be generated in IFS • Restrictions: • Program objects must be ‘Stateless’ • Further Information - http://www.ibm.com/systems/i/software/iws/
Externalizing Web services with RPG on IBM i(Demo) - Simplification and Ease of Use
Web Admin: Install Web Service Access Web Admin http://hostname:2001/HTTPAdmin Click on the Create New Web Services Server link
Deep Dive - IBM i integrated Web services server • IBM i integrated Web services server • Based on Apache AXIS2 version 1.3 - runtime • A set of native service programs and java tools that enable you to build Web service applications from existing ILE RPG/COOBL Programs dynamically generating WSDL and Java Artifacts. • Supported on V5R4, V6R1 • IBM i integrated Web services server has the following capabilities: • Support for Web Services Description Language (WSDL 1.1, supports WSDL 1.2 but right now we are not advertising the fact ) - document literal only • SOAP 1.1 (Enabled) SOAP 1.2 (Disabled) REST (Disabled) - • Supports Web Services Invocation (WSI) 1.0 basic profile compliance • Support for Secure Sockets Layer (SSL) • Java API for XML-based remote procedure call (JAX-RPC) style implementation • Support IBM i non-Java languages; RPG, COBOL, [C,C++]
IBM i Web Services Script Support IBM Integrated Web Services Server – Scripts • GUI avoidance – • QSHELL environment • Automate create/deploy • Deployable applications (ISV’s) • Example: • Create 20 servers – use scripts • Automate RPG/COBOL deployments • Create/Delete Servers
Server Packaging • IBM i integrated Web services server - Server Image • /QIBM/ProdData/OS/WebServices/V1/server • Scripts reside in the ../bin directory • installWebService.sh • listWebServices.sh • startWebServices.sh • stopWebServices.sh • uninstallWebServices.sh • createWebServicesServer.sh • deleteWebServicesServer.sh • startWebServicesServer.sh • stopWebServicesServer.sh • Axis2 1.3 – Engine Runtime • /QIBM/ProdData/OS/OSGi/LWI71/runtime/webservicesmax/eclipse/plugins/org.apache.axis2 • User Web services server • /www/wservice[*] unless user used script • 4 Jobs Run in QHTTPSVR subsystem • 1 HTTP and 3 Web Service jobs WS Server