300 likes | 434 Views
Web self-service: integration of applications and databases. Mandy Shaw. Web self-service. Web enablement Web integration Web development. Agenda. Choosing your mechanisms Availability, performance (both ends), resilience, security Culture and skills issues Development lifecycle issues
E N D
Web self-service: integration of applications and databases Mandy Shaw
Web self-service • Web enablement • Web integration • Web development
Agenda • Choosing your mechanisms • Availability, performance (both ends), resilience, security • Culture and skills issues • Development lifecycle issues • Reusability issues • Synchronous or asynchronous? • Existing middleware, infrastructure and/or interfaces • Problem determination techniques • Open standards • JDBC, XML, Web services (SOAP), JMS • Non-open standards • ODBC • Examples • iSeries specifics
Web self-service: infrastructure,logic elements and data flows MZ Web browser – Intranet user Web browser – potential Extranet or external user Intranet Web server DMZ Web application server Extranet and external Web server Firewall Firewall INTERNET Connectors Internal databases and applications (Other potential external data or transaction sources and targets) Internal application user
Web enablement • CHALLENGE • Motor insurers Admiral Group required a highly secure, highly scalable e-commerce Web site that could be fully integrated with its iSeries-based back end systems • insurance policy management, postcode lookups, credit card processing, … • SOLUTION • A WebSphere-based Web site with real-time integration to Admiral’s back end systems • Live since July 2000 • BENEFITS • Improved customer service • Both online and on the ‘phone • Reduced administration costs and workload
Web enablement DMZ MZ Servlets, JavaBeans and JSPs Stored procedure definitions JDBC using DB2 (DRDA) driver WebSphere Application Server 5.1 New RPG programs using existing logic HTTP / HTTPS protocols IBM HTTP server with SSL I90 LOB application: postcode lookups, credit checking, policy creation, etc. Rating engine runs here for performance
Web enablement • CHALLENGE • Shop fittings suppliers Morplan were selling to retailers via ‘phone/fax from a printed catalogue • Needed a Web channel to grow revenue • SOLUTION • A WebSphere Commerce solution integrated with Morplan’s existing SAP implementation • BENEFITS • Improved customer service and longer ‘opening hours’ • Reduced administration costs and workload • Very considerable revenue growth
Web enablement DMZ MZ WebSphere Commerce Suite 4.1 WCS/SAP standard interface (using RFC), customised Customised BAPI WebSphere Application Server 3.5 SAP HTTP / HTTPS protocols IBM HTTP server with SSL NT
Web integration • CHALLENGE • Optical products suppliers Bausch and Lomb wanted to provide retail opticians with improved order placement and order enquiry facilities • Technology pilot for both Web self-service and application integration • SOLUTION • A customised WebSphere Commerce application • integrated with BPCS via B&L’s strategic middleware • deploying reusable application integration techniques and components • BENEFITS • Improved customer service • Reduced administration costs and workload • Tried-and-tested integration techniques and components
Web integration DMZ MZ EAI hub (e*Gate) NT NT INTERNET Firewall etc. Firewall etc.
Web integration Other XML-based transactions from various sources Routing of requests, retry handling, XML transformation, etc. XML messages, handled by bespoke OFs and commands C API e*Way WebSphere Commerce Suite 4.1 HTTP e*Way WebSphere Application Server 3.5 BPCS IBM HTTP server HTTP / HTTPS protocols ECM WebSphere Application Server 3.02 IBM HTTP server with SSL New RPG programs using existing logic NT Generalised XML handler servlet Stored procedure definitions JDBC using DB2 driver DMZ MZ
Web integration: XML example <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE Message SYSTEM "wcsorder.dtd"> <Message> <MessageHeader> <MessageType MessageMode="Request" MessageTypeDetail="Order"/> <TargetSystem> <CountryCode Country="UK"/> <TargetEnvironment>ELCBP604FL</TargetEnvironment> </TargetSystem> <TimeStamp>20001124155400</TimeStamp> </MessageHeader> <MessageDetail> <OrderRequest> <SourceOrderHeader> <SourceOrderReference>WCS1234567</SourceOrderReference> <CustomerReference>PO54321</CustomerReference> <NumberLines>123</NumberLines> </SourceOrderHeader> <SourceOrderDetail> <SourceOrderReference>WCS1234567</SourceOrderReference> <NumberLines>123</NumberLines> <SKU>1234ABCDEF</SKU> <Quantity>35</Quantity> <LineNo>1</LineNo> </SourceOrderDetail> <SourceOrderDetail> . . . </SourceOrderDetail> </OrderRequest> </MessageDetail> </Message>
Web integration using WebSphere MQ • CHALLENGE • High speed, high volume, Internet-based order entry for customers • SOLUTION • A customised WebSphere application • integrated with BAAN via WebSphere MQ • BENEFITS • 24x7 order placing • Reduced administration costs and workload • Tried-and-tested integration techniques and components
Web integration using WebSphere MQ MZ: BAAN server User store DMZ: Web server Servlets, JavaBeans and JSPs JNI wrappers MQ WebSphere App Server 5.0 HTTP / HTTPS protocols BAAN APIs IBM HTTP server with SSL BAAN
Web development: meet your ancestors • www.1837online.com • Clustered WebSphere and DB2 on Linux RedHat Advanced Server on xSeries • LizardTech DjVu for high performance over dial-up lines • 2.4 million images (converted and cleaned up by us) • 52 day ROI
DMZ Web server MZ Customer Web browser Database server Load Balancer INTERNET FailoverFirewall Firewall Image updates Occasional admin Web server VPN connection Failover database server Web server Internal desktop/server with VPN client
Web development: meet your ancestors DMZ: Web servers MZ: database server Servlets, JavaBeans and JSPs DB2 UDB relational database DB2 JDBC driver WAS 5.1 Network Deployment HTTP / HTTPS protocols Steeleye high availability IBM HTTP server with SSL DB2 UDB relational database - failover
Web self-service: Some product choices MZ Web browser – Intranet user Web browser – potential Extranet or external user Apache on iSeries DMZ Firewall Tomcat or WebSphere Application Server Apache on iSeries, or Apache on xSeries (Windows or Linux) JDBC, stored procedures, JMS, WebSphere MQ, Web services, … INTERNET Firewall Internal databases and applications (Other potential external data or transaction sources and targets) Internal application user
Summary • Availability, performance (both ends), resilience, security • Culture and skills issues • Development lifecycle issues • Reusability issues • Synchronous or asynchronous? • Existing middleware, infrastructure and/or interfaces • iSeries specifics follow …
iSeries application and database integration mechanisms • WebFacing • JDBC • iSeries Toolbox for Java • Direct program calls • Web services
/* JDBC import */ import java.sql.*; /* Variables for DB2/400 connection */ Connection conn = null; PreparedStatement out = null; /* Connect to DB2/400 (DRDA JDBC driver for performance) */ Class.forName("com.ibm.db2.jdbc.app.DB2Driver"); conn = DriverManager.getConnection("jdbc:db2:cat32", “<user>“,“<password>"); /* Prepare INSERT statement (executed once only) */ out = conn.prepareStatement("INSERT INTO MAXDW.ONECALLADJ (LEIUNID, NARRATIVEDATE, NARRATIVETIME, NARRATIVE) VALUES(?, ?, ?, ?)"); /* Use INSERT statement (executed once per record) */ out.setString(1,leiUnid); out.setString(2,narrativeDate); out.setString(3,narrativeTime); out.setString(4,narrative); out.execute(); /* Disconnect from DB2/400 */ conn.close();
DB2/400 JDBC drivers • Native DRDA • iSeries Toolbox for Java JDBC driver
Native DRDA JDBC driver • Runs over SNA or TCP/IP • Very fast, resilient and secure • Does have some JDBC support limitations • No need to add to classpath • Can only test on iSeries server
iSeries Toolbox for Java JDBC driver • 100% pure Java, allowing it to run on any platform • Fewer design limitations than the DRDA driver • Not so fast or resilient as the DRDA driver • Limitation that it will only run over TCP/IP • Needs adding to classpath • Use /QIBM/ProdData/java400/jt400ntv.jar version, or optimise jt400.jar to level 40 with CRTJVAPGM • Development client based testing feasible
iSeries Toolbox also provides classes for direct access to iSeries functionality, e.g. Remote Command. Here is an example: /* Java import for Toolbox */ import com.ibm.as400.access.*; /* AS400 connection and command invoker */ private AS400 myServer = null; myServer = new AS400(“<system>", “<user>", “<password>"); CommandCall cc = new CommandCall(myServer); /* Set up command */ cmd = "RMVLNK OBJLNK('/QFileSvr.400/MYAS400/QDLS/MYFOLDER/" + this.folderName + File.separator + files[i] + "')"; /* Run command - this will generate a Java exception if OS/400 returns an exception */ cc.run(cmd); /* Get messages returned and put in Notes log */ AS400Message[] msgList = cc.getMessageList(); for (int i=0; i < msgList.length; i++) { System.out.println(msgList[i].getText()); }
JNI: Calling RPG code from Java More at http://publib.boulder.ibm.com/infocenter/iadthelp/v6r0/index.jsp?topic=/com.ibm.etools.iseries.pgmgd.doc/c0925076175.htm class MyClass { static { System.loadLibrary ("MYSRVPGM"); } native boolean checkCust (byte custName[]); void anotherMethod () { boolean found; // call the native method found = checkCust (str.getBytes()); } } P checkCust B EXPORT D checkCust PI N D custName 100A VARYING CONST /free chain custName rec; return %found; /end-free P checkCust E
Toolbox and JNI: Message Broker to JDE World program call to Java iSeries job Message Broker iSeries Adapter (via Adapter Framework) JVM within iSeries job iSeries Existing target RPG program, amended to bind to DDSXMLUtil Java class JNI Existing target RPG program Bound in CL initialisation code to set CLASSPATH environment variable and current directory Direct bind using RPG prototype New Java class DDSXMLUtil New Java class DDSXMLUtil to parse request (not yet implemented) and generate XML reply Generated classes to handle externally described data structures Open source XML Java classes Physical files for external descriptions
JNI: Web service call via Java from RPG iSeries job Mapsolute server (via Internet) New STRADDVAL initialisation code to set current directory and create JVM with correct settings (classpath, endorsed directories). Called once per iSeries job, before any JVM has been created JNI Web services interface JVM manipulation instructions JVM within iSeries job iSeries Open source (SAAJ) Web services Java classes New Java class AddressValidation constructs SOAP message, calls web service, parses response Direct bind using RPG prototype New RPG module ADDRSUBMIT New Java class AddressValidation Automatically generated class ADDRESSRFormat (used to build array entry) New RPG module ADDRSUBMIT (bound in to ADDRESSDSP) passing array back to main program module iSeries database table ADDRESS (used for external description only) Main RPG proof of concept application program module ADDRESSDSP
Stored procedure call example // Register correct JDBC driver Class.forName("com.ibm.db2.jdbc.app.DB2Driver"); // Connect to destination machine conn = DriverManager.getConnection("jdbc:db2:cat34","vtuser","vtpwd"); // Prepare call to stored procedure cs = conn.prepareCall("CALL QGPL.TNAPICMD (?,?)"); // Set input parameters cs.setString (1, functionKey); cs.setString (2, reqBuffer); // Run the SQL statement cs.execute (); // Handle the result set, if any rs = cs.getResultSet(); if (rs != null) { // Loop through rows of result set processing each appropriately i = 0; while (rs.next()) { ++i; fieldType = rs.getDouble(2); . [do stuff] . } }