Sunteți pe pagina 1din 40

Enabling 4GL function as web

service
Srinivasan R Mottupalli
IBM India Pvt Ltd

Session: B15

Wednesday, April 29, 2009 • 01:00 – 02:00


2009 IIUG Informix Conference

Disclaimer
© Copyright IBM Corporation 2009. 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.

International Informix Users Group 2


-2-
2009 IIUG Informix Conference

Contents

• Informix 4GL (I4GL)


• SOA Concepts
• Rationale behind SOA for I4GL
• What can we achieve with I4GL v7.50 xC2
• 4GL-SOA Architecture
• Using I4GL SOA
• References

International Informix Users Group 3


-3-
2009 IIUG Informix Conference

I4GL
• Front-end for Informix Database Servers

• Caters to development of database applications

• Character-based user interface

• Easy To Maintain

• Cost and performance advantage over new generation languages

• Extensively used by many Informix customers

International Informix Users Group 4


-4-
2009 IIUG Informix Conference

Before SOA

• Interoperability between system very complex

• Tight coupling among interactive systems

• Migrating existing system to newer technology

International Informix Users Group 5


-5-
2009 IIUG Informix Conference

After 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.”

International Informix Users Group 6


-6-
2009 IIUG Informix Conference

SOA for I4GL - Rationale


• Ease of deployment of 4GL functions as web services

• Easy integration of 4GL with web based applications

• Reuse the existing 4GL functions in web based solutions

• Consuming other services from with in 4GL

• Ease of maintenance

• More business opportunity for your existing 4GL code

International Informix Users Group 7


-7-
2009 IIUG Informix Conference
I4GL SOA Architecture

International Informix Users Group 8


-8-
2009 IIUG Informix Conference

W4GL enables to …
• Create a web service entry

• Manage a web service entries

• Deploy a web service – interface code generation

• Package a web service

• Consume web service – interface code generation

• Trouble shooting

International Informix Users Group 9


-9-
2009 IIUG Informix Conference

Pre-requisites

• Apache Axis2/C Version 1.5 (bundled with 4GL)

• Apache Axis2/Java Version 1.3.1 (bundled with 4GL)

• IBM Informix Dynamic Server Version 7.31 or later

• IBM Informix 4GL 7.50.xC2 or later

• Java™ Runtime Environment (JRE) 1.4 or later

• Perl 5.8.5 or later

International Informix Users Group 10


- 10 -
2009 IIUG Informix Conference

Supported Platforms

• Linux

• * Will also be available on


• Sun Solaris
• HP-UX
• AIX

* Subject to change

International Informix Users Group 11


- 11 -
2009 IIUG Informix Conference
Role of w4gl and w4glc
FUNCTION visa_valid(cc_number, cc_exp, cc_cvp)

w4gl DEFINE vis_rec RECORD


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

LET sel_stmt = "SELECT * FROM visa_validation


WHERE cc_number = ?
Web-service definitions AND cc_exp = ? AND cc_cvp = ?";

PREPARE st_id FROM sel_stmt; Publisher / Subscriber


DECLARE cur_id CURSOR FOR st_id;

4GL OPEN cur_id USING cc_number, cc_exp, cc_cvp;


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

END FUNCTION

International Informix Users Group 12


- 12 -
2009 IIUG Informix Conference

A Sample Configuration Files

International Informix Users Group 13


- 13 -
2009 IIUG Informix Conference
W4GL

A different database can be chosen using an environment


variable PROGRAM_DESIGN_DBS

International Informix Users Group 14


- 14 -
2009 IIUG Informix Conference

Syspgm4gl - Database Design

International Informix Users Group 15


- 15 -
2009 IIUG Informix Conference

Create a web service


Adding a Host Name

International Informix Users Group 16


- 16 -
2009 IIUG Informix Conference

Create a web service


Adding an Application Server

International Informix Users Group 17


- 17 -
2009 IIUG Informix Conference

Create a web service


• Adding database information
 Specify database used by I4GL function

International Informix Users Group 18


- 18 -
2009 IIUG Informix Conference

Create a web service


Adding a Web Service Name of the
web-service
that is exposed

I4GL function
that provides a
service

Input / Output
arguments to /
from the
function

International Informix Users Group 19


- 19 -
2009 IIUG Informix Conference

Create a web service


Input and Output argument entry

International Informix Users Group 20


- 20 -
2009 IIUG Informix Conference

Create a web service


Entering 4GL file details

International Informix Users Group 21


- 21 -
2009 IIUG Informix Conference

Create a web service


Generating configuration file

International Informix Users Group 22


- 22 -
2009 IIUG Informix Conference

Generated Configuration File

International Informix Users Group 23


- 23 -
2009 IIUG Informix Conference

Deploying a web service

• Input to deployment process is the configuration file

• Compiles supplied files

• Generates a Web Services Definition Language (WSDL) file

• Generates Axis2/C interface files

• Copies the files to the location from which application server refers for services

International Informix Users Group 24


- 24 -
2009 IIUG Informix Conference

Deploying a web service


• Needs a configuration file

International Informix Users Group 25


- 25 -
2009 IIUG Informix Conference

Trouble Shooting

International Informix Users Group 26


- 26 -
2009 IIUG Informix Conference

Consuming a web service


• Generates consumption code

International Informix Users Group 27


- 27 -
2009 IIUG Informix Conference

Consuming a web service

International Informix Users Group 28


- 28 -
2009 IIUG Informix Conference

Consuming a web service

International Informix Users Group 29


- 29 -
2009 IIUG Informix Conference

Consuming a web service

International Informix Users Group 30


- 30 -
2009 IIUG Informix Conference

Consuming a web service

International Informix Users Group 31


- 31 -
2009 IIUG Informix Conference

Generated Configuration File

International Informix Users Group 32


- 32 -
2009 IIUG Informix Conference

Steps to consume
• Compile option generates
 Configuration file
 Object file

• User application links this object file

International Informix Users Group 33


- 33 -
2009 IIUG Informix Conference

Managing Web-services
• W4GL allows you to manage

 Host Name

 App Server

 Database

 Web service

International Informix Users Group 34


- 34 -
2009 IIUG Informix Conference

w4glc tool
• Independent tool
• Requires configuration file
• Requires specific command line options
Usage: perl /vobs/tools_4xpm/sqldist/bin/w4glc { [-help] [-version] | [-silent] [-force] [-generate]
[-compile] [-deploy] [-package]} <config-file>
-silent - Do not display the progress
-force - Avoid user prompts
-generate - Generate the code
-compile - Compile the generated code
-deploy - Deploy the web service
-package - Create a package (tar-format) file for web-service

International Informix Users Group 35


- 35 -
2009 IIUG Informix Conference

References

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


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

• IBM Informix 4GL v 7.50.xC2 : Release notes, documentation notes and


machine notes is available at
http://www-01.ibm.com/support/docview.wss?uid=swg27013651

• Developer works Article on deploying 4GL functions as web-services at


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

International Informix Users Group 36


- 36 -
2009 IIUG Informix Conference

Session: B15
Enabling 4GL Function as Web Service

Srinivasan R Mottupalli
IBM India Private Limited
mrsrinivas@in.ibm.com

International Informix Users Group 37


- 37 -
2009 IIUG Informix Conference

Backup slides

International Informix Users Group 38


- 38 -
2009 IIUG Informix Conference

Role of w4gl and w4glc


User Interface Configuration File
(w4gl) (.4cf)

PERL script
Input definitions (w4glc)
IDS
-Hostname
Program
-Appserver
Design
-Database
DB
-WebService
-Subscriber Generate Code

Deploy Consume

International Informix Users Group 39


- 39 -
2009 IIUG Informix Conference

Configuration File - Deployment


[SERVICE]
TYPE = publisher
INFORMIXDIR = /vobs/tools_4xpm/sqldist
DATABASE = i4glsoa
CLIENT_LOCALE = en_US.8859-1
DB_LOCALE = en_US.8859-1
INFORMIXSERVER = loc_ids11_mrs
HOSTNAME = idcxs2.in.ibm.com
PORTNO = 9876
I4GLVERSION = 7.50.xC2
WSHOME = /vobs/tools_4xpm/sqldist/AXIS2C
WSVERSION = AXIS1.5
TMPDIR = /tmp/w4gl
SERVICENAME = ws_demo
[FUNCTION]
NAME = test_demo
INPUT = CHAR(10),
OUTPUT = CHAR(100), CHAR(100),
[END-FUNCTION]
[DIRECTORY]
NAME = /tmp/soademo
FILE = soademo.4gl,
[END-DIRECTORY]
[END-SERVICE]

International Informix Users Group 40


- 40 -

S-ar putea să vă placă și