Vous êtes sur la page 1sur 48

2010 IIUG Informix

Informix Conference
4GL functions usage in the GUI
environment via web services

Srinivasan R Mottupalli Session: C07


Architect, IBM, ISL, India Tuesday, April 27, 2010: 08:00 – 09:00
2010 IIUG Informix Conference
Disclaimer

© Copyright IBM Corporation 2010. All rights reserved.


U.S. Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule
Contract with IBM Corp.

THE INFORMATION CONTAINED IN THIS PRESENTATION IS PROVIDED FOR INFORMATIONAL PURPOSES


ONLY. WHILE EFFORTS WERE MADE TO VERIFY THE COMPLETENESS AND ACCURACY OF THE
INFORMATION CONTAINED IN THIS PRESENTATION, IT IS PROVIDED “AS IS” WITHOUT WARRANTY OF
ANY KIND, EXPRESS OR IMPLIED. IN ADDITION, THIS INFORMATION IS BASED ON IBM’S CURRENT
PRODUCT PLANS AND STRATEGY, WHICH ARE SUBJECT TO CHANGE BY IBM WITHOUT NOTICE. IBM
SHALL NOT BE RESPONSIBLE FOR ANY DAMAGES ARISING OUT OF THE USE OF, OR OTHERWISE
RELATED TO, THIS PRESENTATION OR ANY OTHER DOCUMENTATION. NOTHING CONTAINED IN THIS
PRESENTATION IS INTENDED TO, NOR SHALL HAVE THE EFFECT OF, CREATING ANY WARRANTIES OR
REPRESENTATIONS FROM IBM (OR ITS SUPPLIERS OR LICENSORS), OR ALTERING THE TERMS AND
CONDITIONS OF ANY AGREEMENT OR LICENSE GOVERNING THE USE OF IBM PRODUCTS AND/OR
SOFTWARE.

IBM, the IBM logo, ibm.com, FileNet, OmniFind and all IBM FileNet products are trademarks or registered
trademarks of International Business Machines Corporation in the United States, other countries, or both. If these
and other IBM trademarked terms are marked on their first occurrence in this information with a trademark symbol (®
or ™), these symbols indicate U.S. registered or common law trademarks owned by IBM at the time this information
was published. Such trademarks may also be registered or common law trademarks in other countries. A current list
of IBM trademarks is available on the Web at “Copyright and trademark information” at
www.ibm.com/legal/copytrade.shtml

Other company, product, or service names may be trademarks or service marks of others.

2
2010 IIUG Informix Conference
Contents

ƒ Informix 4GL
ƒ Problem statement
ƒ Service Oriented Architecture (SOA)
ƒ Prerequisites and Supported Platforms
ƒ Publish Web services
ƒ Consume Web services
ƒ Troubleshooting
ƒ Informix 4GL: Road Ahead
ƒ Demos
ƒ References

3
2010 IIUG Informix Conference

Informix 4GL

ƒ Front-end for Informix database servers


ƒ Caters to development of database applications
ƒ Character-based user interface (CUI)
ƒ Rich environment of forms and reports
ƒ Easy to maintain
ƒ Cost and performance advantage over new generation languages
ƒ Extensively used by many Informix customers

4
2010 IIUG Informix Conference
Problem Statement

• Lots and lots of application code including reports written in I4GL


– How to reuse the existing I4GL code and I4GL skill set?

• Character-based user interface (CUI)


– How do we make use of GUI yet doing things with I4GL?

• Solution: I4GL-SOA

5
2010 IIUG Informix Conference
Service Oriented Architecture (SOA)

ƒ Separate core business


functions
ƒ Maximal use of IT assets &
investments
ƒ Open communication
environment
ƒ On demand infrastructure
ƒ Connect processes online
ƒ Process automation
ƒ Better control over information
ƒ Reusability
ƒ Agile

6
2010 IIUG Informix Conference
Before I4GL-SOA
• Interoperability between distributed system was very complex
• Tight coupling among interactive systems
• Migrating existing system to newer technology

7
2010 IIUG Informix Conference
After I4GL-SOA
• Efficient, flexible and agile systems in place
• Interoperability between distributed system made easy
• Loose coupling among interactive systems
• Needless to migrate existing system to newer technology

“A collection of loosely-coupled, distributed services which communicate


and interoperate via agreed standards.”

8
2010 IIUG Informix Conference
I4GL-SOA – Rationale
• Ease of deployment of I4GL functions as web services
• Easy integration of I4GL with web based applications
• Reuse the existing I4GL functions in web based solutions
• Consuming I4GL services from within I4GL
• Consuming third party services from within I4GL
• Ease of maintenance
• More business opportunity for your existing I4GL code

9
2010 IIUG Informix Conference
Benefit to Customers

• Reuse algorithms and business logic


- Internet
- Another partner/company location
• Think process and not screens or forms
• Seamless operation across multiple programming languages and
platforms
• Efficient collaboration across departments
• Create “Dictionary” of available functionality/expertise
• Save precious dollars in time and effort

10
2010 IIUG Informix Conference
I4GL-SOA Architecture

Web Service

Publish Consume

Publisher Subscriber

Apache AXIS2C Web Server

IBM Informix 4GL

IDS
11
2010 IIUG Informix Conference
Prerequisites and Supported Platforms
ƒ Prerequisites
– Apache Axis2/C Version 1.5.1 (bundled with I4GL)
– Apache Axis2/Java Version 1.3.1 (bundled with I4GL)
– IBM Informix Dynamic Server Version 10 or later
– IBM Informix 4GL 7.50.xC4
– Java™ Runtime Environment (JRE) 1.5 or later
– Perl 5.8.8

ƒ Supported Platforms
– HP-IA 11.23 or 11.31
– AIX 5.3 and 6.1
– Red Hat Enterprise Linux 4 or 5
– Solaris 5.9 or 5.10
– SUSE® Linux Enterprise Server 10

12
2010 IIUG Informix Conference
Role of w4gl and w4glc

FUNCTION visa_valid(cc_number, cc_exp, cc_cvp)

w4gl DEFINE vis_rec RECORD LIKE visa_validation.* , w4glc


cc_number Configuration
CHAR(16), File (.4cf)
(User Interface) cc_exp CHAR(5), (Perl script)
cc_cvp CHAR(3),
sel_stmt CHAR(512);

LET sel_stmt = "SELECT * FROM visa_validation


WHERE cc_number = ?
AND cc_exp = ? AND cc_cvp = ?";

Web-service definitions PREPARE st_id FROM sel_stmt;


DECLARE cur_id CURSOR FOR st_id;
Publisher / Subscriber

OPEN cur_id USING cc_number, cc_exp, cc_cvp;


FETCH cur_id INTO vis_rec.*;
4GL CLOSE cur_id;
source FREE cur_id;
FREE st_id;
code IDS
RETURN vis_rec.cc_name, vis_rec.cc_balance, vis_rec.cc_limit

END FUNCTION
Publish Subscribe
2010 IIUG Informix Conference
W4GL

A different database can be chosen using an


environment variable PROGRAM_DESIGN_DBS

14
2010 IIUG Informix Conference
W4GL facilitates
ƒ Create a web service entry
ƒ Manage a web service entry
ƒ Generates configuration for publisher and subscriber
ƒ Deploys/Publish a web service
ƒ Package a deployed web service
ƒ Parse WSDL – Source can be URL and file
ƒ Generates code for consumer/subscriber
ƒ Trouble shooting
ƒ Persistent web service entries for regeneration

15
2010 IIUG Informix Conference
Schema Design

16
2010 IIUG Informix Conference
Publish / Subscribe – Work flow

•I4GL function
Publisher

•Service name App I4GL


Runtime IDS
•I/O arguments Server
•4GL files

Other web
IDS Non-I4GL services
consumer

•WSDL
Subscriber

I4GL
•Operation name
•I4GL function
Object file + I4GL
consumer
•Target Directory

17
2010 IIUG Informix Conference
MACH 11 topology

Client Apps
Connection Manager
(workload balancing and failover arbitration)
Client Apps

HDRTraffic

IDSAdmin
HDRSecondary
Primary
SDS

Shared
Blade Server A Disk Shared Blade Server B
City-A RSSTraffic Disk
City-B
DBA
IDSAdmin

SDS Shared
Disk RSS
Mirror
SDS

Blade Server D
City-A
Shared Blade Server C
Disk City-D
18
2010 IIUG Informix Conference
I4GL-SOA and MACH11

Connection
Manager
•I4GL function
Publisher

•Service name App I4GL


Runtime IDS
•I/O arguments Server
•4GL files

Connection Other web


Manager
IDS Non-I4GL services
consumer

•WSDL
Subscriber

I4GL
•Operation name
•I4GL function
Object file + I4GL
consumer
•Target Directory

19
2010 IIUG Informix Conference
Publishing / Deploying Process overview

FUNCTION visa_valid(cc_number, cc_exp, cc_cvp)


w4gl Configuration
w4glc
DEFINE vis_rec RECORD LIKE visa_validation.* , File (.4cf)
(User Interface)
cc_number CHAR(16), (Backend script)
cc_exp CHAR(5),
cc_cvp CHAR(3),
sel_stmt CHAR(512);

LET sel_stmt = "SELECT * FROM visa_validation


Informix 4GL
WHERE cc_number = ? function
AND cc_exp = ? AND cc_cvp = ?";
I4GL function
PREPARE st_id FROM sel_stmt;
ServiceDECLARE
name cur_id CURSOR FOR st_id; Compile and generate
I/O arguments Shared object
OPEN cur_id USING cc_number, cc_exp, cc_cvp;
4GL files
FETCH cur_id INTO vis_rec.*;
CLOSE cur_id;
FREE cur_id;
FREE st_id;
Deploy
Publish IDS
RETURN vis_rec.cc_name, vis_rec.cc_balance, vis_rec.cc_limit

END FUNCTION
App Server

20
2010 IIUG Informix Conference
Defining a Web Service for Publishing
• Basic environment description
– Hostname
– Application server
– Database
• Web Service
– Service name, function name
– Input and Output parameters
– Existing I4GL source code
– Generate and build

21
2010 IIUG Informix Conference
Define: Publishing

• Adding a Web Service Name of the


web-service
that is exposed

I4GL function
that provides a
service

22
2010 IIUG Informix Conference
Define: Publishing
• Input and output arguments

Input / Output
arguments to /
from the function

23
2010 IIUG Informix Conference
Define: Publishing
• Entering 4GL file details

24
2010 IIUG Informix Conference
Generate configuration for Publishing
• Generating configuration file

25
2010 IIUG Informix Conference
Generated configuration file

….
TYPE = publisher
….

26
2010 IIUG Informix Conference
Deploying a web service
• Needs a configuration file

27
2010 IIUG Informix Conference
Deploying a web service

• Input is the configuration file


• Compiles supplied files
• Generates a Web Services Definition Language (WSDL) file
• Generates Axis2/C interface files
• Generates the shared object
• Copies the files to the location which application server uses

28
2010 IIUG Informix Conference
Subscribing / Consuming Process overview

MAIN
CALL call_web_service_client()
w4gl MAIN
END
Configuration File (.4cf)
w4glc
(User Interface)
FUNCTION call_web_service_client() (Backend script)
DEFINE name VARCHAR(40),
address VARCHAR(200),
...
transaction_date DATE,
description VARCHAR(250),
value INTEGER
...
OPEN FORM f_credit FROM "svc_client"
Generate and Compile
DISPLAY FORM f_credit Intermediate code
INPUT card_number, cvv_number, expiry_date
Web service FROM s_card.card_number, s_card.cvv_number, s_card.expiry_date

details CALL i4gl_cc_details(card_number, expiry_date, cvv_number) Informix 4GL


RETURNING name, address, city, state, zipcode, phone, email, source
card_number, creditLimit, cardType,
transaction_date, description, value
code

DISPLAY name TO s_card.name


DISPLAY address TO s_card.address
Subscribe ... IDS
...
DISPLAY description TO s_card.description
DISPLAY value TO s_card.value Executable using web service
END FUNCTION
functionality

29
2010 IIUG Informix Conference
Consuming a web service
• Generates consumption code

30
2010 IIUG Informix Conference
Consuming a web service
• Generates consumption code

31
2010 IIUG Informix Conference
Consuming a web service

32
2010 IIUG Informix Conference
Consuming a web service

33
2010 IIUG Informix Conference
Generated Configuration File

….
Data extracted from
TYPE = subscriber
WSDL
….

34
2010 IIUG Informix Conference
Steps to consume
• Compile option generates
– Configuration file
– Object file

• User application links this object file to create executable

35
2010 IIUG Informix Conference
Reports
• Reports can also be generated from web-service
• Reports function can be deployed similar to other functions
• New type for file WS_FILENAME introduced in w4gl UI and config
file
• Generated report
– Received at the client side
– Stored at the client side in the target directory
– Known file extensions are honored

36
2010 IIUG Informix Conference
[SERVICE]
Report function
TYPE =as web-service
subscriber
I4GLVERSION = 7.50.xC4
WSHOME = /home/informix/4GL/AXIS2C
• Similar to deploying other services
TARGET_DIR = /home/informix/IIUG_demo/i4gl-report/
I4GL_FUNCTION = client_report

• TARGET_FILE = client_report.c
Similar to consuming other services
[WSDL_INFO]
New Type
WSDL_PATH = /home/informix/IIUG_demo/i4gl-report//local.wsdl WS_FILENAME
WSDL_NAME_SPACE = http://www.ibm.com/genreport_cc_details
[FUNCTION]
SERVICENAME = ws_gen_report
NAME = genreport_cc_details
[INPUT]
[VARIABLE] NAME = card_number TYPE = varchar(19) [END-VARIABLE]
[VARIABLE] NAME = expiry_date TYPE = varchar(5) [END-VARIABLE]
[VARIABLE] NAME = cvv_number TYPE = varchar(3) [END-VARIABLE]
[END-INPUT]
[OUTPUT]
[VARIABLE] NAME = stmt_report TYPE = ws_filename [END-VARIABLE]
[END-OUTPUT]
[END-FUNCTION]
[END-WSDL_INFO]
[END-SERVICE]

37
2010 IIUG Informix Conference
REPORT cust_list (r_customer, r_trans)FUNCTION genreport_cc_details(lcard_number, lexpiry_date, lcvv_number)
Report function as web-service
DEFINE r_customer RECORD LIKE credit_customer.*
DEFINE lcard_number VARCHAR(19),
DEFINE r_trans RECORD LIKE card_transaction.*
lexpiry_date VARCHAR(5),
FUNCTION call_web_service_client()
lcvv_number VARCHAR(3),
• Similar to consuming other services
OUTPUT
p_qrystmt VARCHAR(255),
TOP MARGIN 0 DEFINE file VARCHAR(255),
BOTTOM MARGIN 0 file VARCHAR(255)
cc_num VARCHAR(19),
PAGE LENGTH 25 DEFINE p_customer RECORD LIKE credit_customer.*,
exp_date VARCHAR(5),
p_trans RECORD LIKE card_transaction.*
cvv_num VARCHAR(3)
FORMAT
DEFINE l_ans CHAR(1),
ON EVERY ROW LET p_qrystmt = "SELECT * FROM card_transaction \
p_msg CHAR(50)
PRINT "STATEMENT FOR CREDIT CARD " || r_customer.card_number WHERE customerid = ?";
PRINT "---------------------------------------------" LET file = "cust_listing.html"
PRINT "To" OPEN FORM f_input FROM "client"
START REPORT cust_list TO OUTPUT "FILE" DESTINATION file
PRINT " " DISPLAY FORM f_input
DECLARE q_curs CURSOR FOR
PRINT " " || r_customer.name INPUT cc_num, cvv_num, exp_date FROM
SELECT * FROM credit_customer
PRINT " " || r_customer.address s_card.card_number, s_card.cvv_number,
WHERE card_number = lcard_number
PRINT " " || r_customer.city || ", " || r_customer.state || ", " || s_card.expiry_date
r_customer.zipcode AND expiry_date = lexpiry_date
PRINT " " AND cvv_number = lcvv_number
CALL client_report(cc_num, exp_date, cvv_num)
PRINT "Ph: " || r_customer.phone PREPARE stmt_1 FROM p_qrystmt
RETURNING file
PRINT "Email: " || r_customer.email DECLARE q_trans CURSOR FOR stmt_1
PRINT " "
DISPLAY cc_num TO s_card.card_number
PRINT " " FOREACH q_curs INTO p_customer.*
DISPLAY cvv_num TO s_card.cvv_number
PRINT "Credit Limit : " || r_customer.creditLimit OPEN q_trans USING p_customer.customerid
PRINT " " DISPLAY exp_date TO s_card.expiry_date
FETCH q_trans INTO p_trans.*
PRINT "Transaction Details" DISPLAY file TO s_card.rep_file
OUTPUT TO REPORT cust_list(p_customer.*, p_trans.*)
PRINT "-------------------" CLOSE q_trans
PRINT r_trans.transaction_Date || " " || END FUNCTION
END FOREACH
r_trans.description || " " ||
r_trans.value
FINISH REPORT cust_list
PRINT " "
PRINT " " RETURN file
END REPORT END FUNCTION

38
2010 IIUG Informix Conference
Trouble Shooting

39
2010 IIUG Informix Conference
Command Line Utility (W4GLC)
• For Advanced users
• Manually create a configuration file
• Data in configuration file not stored in database

W4GLC {-OPTION} <configuration-file>


OPTION DESCRIPTION

silent Generates code without on-screen display

keep Retain intermediate source files for troubleshooting

force Overwrite existing service with identical name

generate Generate intermediate code for publish/subscribe

compile Compile generated intermediate code

deploy Deploy web service on the AXIS2C server

package Bundling a web service for production deployment

40
2010 IIUG Informix Conference
W4GL – A glance
• Management of web-service details
• Persistent data for easy regeneration of configurations
• Flexible design to deploy a service remotely
• Easy administration
• Written in I4GL
• Ease of use for I4GL users
• Automation using WSDL parser
• Validation using data type parser
• Remote error propagation

41
2010 IIUG Informix Conference
Demos

• Publishing an I4GL web service

• Consuming an I4GL web service using an non-I4GL subscriber

• Consuming an I4GL web service using an I4GL subscriber

• Generating and consuming reports

42
2010 IIUG Informix Conference
Informix 4GL: Road Ahead
I4GL Interim
Releases
4GL 7.x 2012 and beyond
(I4GL ƒ Form enhancements
Modernization) ƒ System curses
ƒ Improved color
ƒ Form enhancements
4GL 7.x ƒ Box
ƒ Horizontal Scrolling
(I4GL ƒ Multi-line fields in screen arrays
ƒ Form and field status
4GL 7.x Embeddability) ƒ Variable size forms
ƒ List support ƒ Enhanced Sub-table handling
(SOA enablement) ƒ Library support
ƒ Report enhancements ƒ Mac OS
ƒ SOA enablement ƒ I4GL non-interactive part as
library ƒ XML output ƒ Native Library
9Reports via web services
ƒ Function signature ƒ Dynamic load of shared ƒ Enhanced Language ƒ Enhance Language support
detection (I4GL parser) library by p-code runner support ƒ New SQL syntax from IDS
9 Enhanced Error handling ƒ Certification of non-interactive ƒ New I4GL syntax ƒ SOA Enablement
I4GL-LIB for web
9 RECORD type ƒ Client Required Priority ƒ WAS support
languages/tools.
9 AIX port of SOA Defect Fixes
ƒ Report enhancements
ƒ Mac OS basic port
9 WSDL parser ƒ PDF support
ƒ Evaluation copy
9 Enhance Language support ƒ I4gl in IDS
9File I/O support ƒ P-code, C-code, ISQL & ID

9 Client Required Priority ƒ Client Required Priority


Defect Fixes Defect Fixes

Q2 2010 Q4 2010 Q2 2011


Disclaimer: The information on the new product is intended to outline our general product direction and it should not be relied on in making a purchasing decision. The information on the new product is for informational purposes only and may not be incorporated
into any contract. The information on the new product is not a commitment, promise, or legal obligation to deliver any material, code or functionality. The development, release, and timing of any features or functionality described for our products remains at our sole
discretion.

43
2010 IIUG Informix Conference
Summary
• Tools w4gl and w4glc
• I4GL-SOA can
– publish functions to web services
– subscribe functions from other web services
• Reuse of existing code and skill set
• I4GL code can be used in GUI
• Opens new business opportunities
• Aggressive enhancements to I4GL
• New investments to I4GL

44
2010 IIUG Informix Conference
References

• IBM Informix 4GL v 7.50.xC4 documents available at : TBD


http://www-01.ibm.com/support/docview.wss?uid=swg27013652

• IBM Informix 4GL v 7.50.xC4, xC3: Release notes, documentation notes and
machine notes is available at
TBD
http://www-01.ibm.com/support/docview.wss?uid=pub1gi11910302

• Developer works on “Deploying 4GL functions as web-services” at


http://www.ibm.com/developerworks/data/library/techarticle/dm-0902mottupalli/

• Developer works on “Consume Web services using Informix 4GL” at


http://www.ibm.com/developerworks/data/library/techarticle/dm-
0910i4glwebservices/index.html

45
2010 IIUG Informix Conference

Questions
!!!

46
2010 IIUG Informix Conference
Signup to participate in user feedback sessions for IDS
Session opportunities include:

‰ Hands on experience test driving the latest Schema and


Storage Manager UIs for the OpenAdmin Tool

‰ A sneak peak and feedback on the new IDS Installation and


Configuration Tooling/UI: A group walkthrough discussion with the
IDS Dev team

‰ A sneak peak and feedback on the new IDS Deployment


Tooling/UI: A group walkthrough discussion with the IDS Dev team

‰ Your opportunity to give your input on useful sources and


resources for solving problems encountered while using IDS:
An examination of current and future resources followed by a
group exercise to provide your preferences

‰ How Optim may be used for problem determination and


resolution with IDS A walkthrough and group discussion

Look for posters and47 sign-up sheets


2010 IIUG Informix Conference

Informix 4GL functions usage in the GUI


environment via web-services

Thank you !!!


Srinivasan R Mottupalli

mrsrinivas@in.ibm.com

Session: C07

48

Vous aimerez peut-être aussi