Internet Application Development with Mqseries and Java
Total Page:16
File Type:pdf, Size:1020Kb
SG24-4896-00 Internet Application Development with MQSeries and Java February 1997 SG24-4896-00 International Technical Support Organization Internet Application Development with MQSeries and Java February 1997 IBML Take Note! Before using this information and the product it supports, be sure to read the general information in Appendix D, “Special Notices” on page 151. First Edition (February 1997) This edition applies to: • IBM OS/2 Warp Version 4.0 • IBM Internet Server for OS/2 Version 4.2 beta • IBM MQseries for OS/2 Version 2.01 • IBM MQSeries Client for Java SDK, program number 5639-C34 • Netscape Navigator Version 2.02 for • Microsoft Windows NT Version 4.0 Workstation • Microsoft Internet Explorer Version 3.0 • Microsoft Windows 95 Comments may be addressed to: IBM Corporation, International Technical Support Organization Dept. HZ8 Building 678 P.O. Box 12195 Research Triangle Park, NC 27709-2195 When you send information to IBM, you grant IBM a non-exclusive right to use or distribute the information in any way it believes appropriate without incurring any obligation to you. Copyright International Business Machines Corporation 1997. All rights reserved. Note to U.S. Government Users — Documentation related to restricted rights — Use, duplication or disclosure is subject to restrictions set forth in GSA ADP Schedule Contract with IBM Corp. Contents Figures . vii Tables . ix Preface . xi The Team That Wrote This Redbook ...................... xi Comments Welcome . xiii Chapter 1. MQSeries Client for Java Positioning .............. 1 Chapter 2. Introduction . 3 2.1 About the Objectives ............................. 3 2.2 About the Demonstration Program .................... 5 Chapter 3. Installation . 9 3.1 IBM Internet Connection Secure Server ................. 10 3.1.1 How to Get the ICSS .......................... 10 3.1.2 How to Install the ICSS on OS/2 ................... 11 3.2 Netscape Navigator for OS/2 ........................ 17 3.2.1 How to Get the Browser ........................ 18 3.2.2 How to Install the Browser ...................... 18 3.2.3 How to Set Up the Browser for Java ................. 19 3.3 MQSeries Client for Java .......................... 19 3.3.1 How to Get the MQSeries Client for Java .............. 20 3.3.2 Installing the Documentation ..................... 21 3.3.3 Installing the MQSeries Client for Java ............... 22 3.3.4 Running the Installation Verification Applet ............ 24 3.4 Apache Internet Server for AIX ....................... 24 3.4.1 How to Get Apache ........................... 24 3.4.2 Notes Regarding Apache ....................... 24 Chapter 4. HTML Overview . 27 4.1 How to Build an HTML File ......................... 28 4.2 How to Build a Link ............................. 36 4.3 How to Load an Applet ........................... 39 Chapter 5. Java Overview . 41 5.1 Some Basics about Java .......................... 41 5.1.1 Java Is Platform-Independent ..................... 41 5.1.2 Java Is Distributed ........................... 42 5.1.3 Java Is Secure .............................. 43 Copyright IBM Corp. 1997 iii 5.1.4 Java Is Robust .............................. 43 5.1.5 Java Is Object-Oriented ........................ 44 5.2 Applications and Applets .......................... 45 5.3 A First Try with Java ............................. 45 5.3.1 The Hello World Application ...................... 46 5.3.2 The Hello World Applet ......................... 47 Chapter 6. MQSeries Overview . 53 6.1 What Is Messaging and Queuing? ..................... 54 6.1.1 Messages . 54 6.1.2 Queue Manager . 55 6.1.3 Queue Manager Objects ........................ 56 6.2 Manipulating MQM Objects ......................... 57 6.3 Message Queues . 59 6.3.1 Local Queue . 59 6.3.2 Remote Queue . 59 6.3.3 Transmission Queue . 60 6.3.4 Dynamic Queue . 60 6.3.5 Model Queue . 60 6.3.6 Alias Queue . 60 6.3.7 Initiation Queue . 60 6.3.8 Reply-To Queue . 61 6.3.9 Dead-Letter Queue . 61 6.4 Clients and Servers ............................. 61 6.4.1 How to Define a Client/Server Connection ............. 62 6.4.2 How to Start a Client/Server Connection .............. 64 6.4.3 How to Test a Client/Server Connection .............. 64 6.4.4 How to Test a Client/Server Connection with MQSeries for Java 66 6.4.5 How to Trigger Applications ...................... 68 6.5 Message Queuing Interface (MQI) ..................... 70 Chapter 7. MQSeries Client for Java ...................... 73 7.1 Who Should Read This ........................... 73 7.2 Overview of MQSeries Client for Java .................. 73 7.3 Running the Installation Verification Program .............. 77 7.3.1 Running from a Local Disk Installation ............... 78 7.3.2 Running from a Web Server Installation ............... 79 7.4 Using the Verification Applet to Test Your Customer′s Access .... 81 7.5 Running Your Own Applets ......................... 81 Chapter 8. MQSeries Client for Java Programmer′s Guide ........ 83 8.1 Who Should Read This ........................... 83 8.2 MQSeries Client for Java Support ..................... 83 8.2.1 Java Developer′s Kit (JDK) ...................... 83 iv Internet Application Development with MQSeries and Java 8.2.2 Java Client Class Library ....................... 84 8.2.3 Writing Programs for the MQSeries Client for Java ........ 84 8.2.4 Sample Code Fragment ........................ 85 8.3 Why Should I Use the Java Interface? .................. 89 8.4 The MQSeries Java Programming Interface ............... 90 8.4.1 Handling Errors . 91 8.4.2 Operations on Queue Managers ................... 91 8.4.3 Accessing Queues and Processes .................. 93 8.4.4 Handling Messages . 94 8.4.5 Inquire and Set ............................. 95 8.4.6 Multithreaded Programs . 96 8.4.7 Writing User Exits ............................ 97 8.5 Compiling MQSeries Java Programs ................... 99 8.6 Tracing MQSeries Java Programs .................... 100 8.7 Class Hierarchy . 101 Chapter 9. The Sample Application ..................... 105 9.1 Overview . 105 9.1.1 Functions of the Application ..................... 105 9.1.2 Software Used to Develop the Applet ............... 106 9.1.3 A View of the Internet ........................ 107 9.1.4 The Value of This Application .................... 107 9.2 Program Logic and Message Flow ................... 108 9.3 Design Issues . 112 9.3.1 Message Flow Diagram ....................... 112 9.3.2 MQSeries Objects . 112 9.3.3 Programs . 113 9.3.4 Message Structure . 114 9.3.5 Inventory Files . 114 9.4 Set Up the Demonstration ......................... 115 Appendix A. Client Program .......................... 117 A.1 OrderlistApplet.html . 117 A.2 OrderListView.java . 117 A.3 FBPUTQ1.java . 128 A.4 FBGETQ2.java . 130 A.5 GTCGET.java . 132 Appendix B. Server Program . 135 B.1 Business Logic BL1.C ........................... 135 B.2 Make File . 147 B.3 Definition File . 147 Appendix C. Diskette Contents . 149 Contents v Appendix D. Special Notices . 151 Appendix E. Related Publications . 153 E.1 International Technical Support Organization Publications ..... 153 E.2 Redbooks on CD-ROMs .......................... 153 E.3 Other Publications . 153 How to Get ITSO Redbooks .......................... 155 How IBM Employees Can Get ITSO Redbooks ............... 155 How Customers Can Get ITSO Redbooks .................. 156 IBM Redbook Order Form ........................... 157 Glossary . 159 List of Abbreviations .............................. 163 Index . 165 ITSO Redbook Evaluation ............................ 167 vi Internet Application Development with MQSeries and Java Figures 1. Computer Network Envisioned for This Project . 4 2. Demo Web Page Shown by Netscape Navigator (Java-Enabled) . 6 3. Demo Web Page Shown by IBM WebExplorer (Not Java-Enabled) . 7 4. Order Entry Applet from the Demo Application . 8 5. Internet Connection Server Installation . 12 6. Internet Connection Server Installation - Configuration . 14 7. Internet Connection Server - Icon View . 16 8. Example of a Server Front Page . 17 9. Netscape Navigator Install Window . 18 10. Netscape Navigator Icon View ...................... 19 11. MQSeries Client for Java Documentation (index.html) ........ 21 12. HTML Example - Part 1: An HTML Page ................ 28 13. HTML File - Part 1 ............................. 29 14. HTML Example - Part 2: Headings .................... 30 15. HTML File - Part 2 ............................. 31 16. HTML Example - Part 3: Emphasizing .................. 32 17. HTML File - Part 3 ............................. 33 18. HTML Example - Part 4: Lists ....................... 34 19. HTML File - Part 4 ............................. 35 20. HTML Example - Part 5: Links ...................... 36 21. HTML File - Part 5 ............................. 37 22. HTML Example - Part 6: More Links ................... 38 23. HTML Example - Part 6 .......................... 38 24. HTML Displays an Applet ......................... 39 25. HTML Example - Display an Applet ................... 39 26. Difference between C And Java Compiler ............... 42 27. A Simple Java Application ........................ 46 28. A Simple Java Applet ........................... 47 29. HTML File that Calls an Applet ...................... 49 30. MQSeries at Runtime ........................... 53 31. Message Queuing: Principle ....................... 54 32. RUNMQSC - Interactive .......................... 58 33. RUNMQSC - Using Command File .................... 58 34. RUNMQSC - Input File ..........................