IBM WebSphere MQ Version 6 And Web Services

Transcription

Front coverWebSphere MQ Version 6and Web ServicesInteroperable Web Services using .NET, Axis,and IBM WebSphere Application ServerWebSphere MQ transport forSOAP, .NET, and Java classesAsynchrony andtransactionalitySaida DaviesCraig BothGary O’ConnorSushil SharmaPaul SlaterOpe SoyannwoJerry L Stevensibm.com/redbooks

International Technical Support OrganizationWebSphere MQ Version 6 and Web ServicesOctober 2006SG24-7115-00

Note: Before using this information and the product it supports, read the information in“Notices” on page xvii.First Edition (October 2006)This book includes an update of the material present in WebSphere MQ Solutions in aMicrosoft .NET Environment, SG24-7012Version 1 Release 1 (or earlier) of Microsoft .NET FrameworkVersion 1 Release 1 (or earlier) of Microsoft .NET SDKVersion 6 Release 0 of IBM WebSphere MQVersion 6 Release 0 of IBM Rational Application DeveloperVersion 6 Release 0 of IBM WebSphere Application Server for IBM AIXVersion 6 Release 0 of IBM WebSphere MQ V6.0 - SupportPac MA0VVersion 1 Release 4 of IBM Java SDK Copyright International Business Machines Corporation 2006. All rights reserved.Note to U.S. Government Users Restricted Rights -- Use, duplication or disclosure restricted by GSA ADPSchedule Contract with IBM Corp.

ContentsFigures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xiTables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xvNotices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xviiTrademarks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xviiiPreface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xixThe team that wrote this IBM Redbook . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxBecome a published author . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxiiiComments welcome. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxivPart 1. Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1Chapter 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31.1 Object-orientation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41.2 Self-description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41.3 Messaging . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5Chapter 2. Objectives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72.1 Programming models . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82.2 Overview of the chapters. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9Chapter 3. Technologies . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133.1 Web Services . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143.1.1 Universal Resource Identifier . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143.1.2 Extensible Markup Language . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 153.1.3 Universal Description Discovery and Integration . . . . . . . . . . . . . . . 163.1.4 Understanding Web Services Description Language . . . . . . . . . . . . 163.2 Simple Object Access protocol (SOAP) . . . . . . . . . . . . . . . . . . . . . . . . . . 183.3 Microsoft .NET. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 193.3.1 .NET Framework and the Common Language Runtime . . . . . . . . . . 203.3.2 Internet Information Services and Active Server Pages . . . . . . . . . . 203.3.3 COM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 213.3.4 Visual Studio .NET . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 213.4 IBM WebSphere Application Server . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 223.4.1 Java 2 Platform, Enterprise Edition . . . . . . . . . . . . . . . . . . . . . . . . . . 223.4.2 IBM Rational Application Developer for WebSphere Software . . . . . 233.4.3 SOAP/Java Message Service . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 233.5 Apache Axis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24 Copyright IBM Corp. 2006. All rights reserved.iii

3.6 WebSphere MQ V6 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24Part 2. Web Services and security considerations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27Chapter 4. WebSphere Services with WebSphere MQ. . . . . . . . . . . . . . . . 294.1 SOAP over Hypertext Transfer Protocol . . . . . . . . . . . . . . . . . . . . . . . . . . 304.2 SOAP over WebSphere MQ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 314.3 Client applications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 324.3.1 Axis clients . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 334.3.2 Microsoft .NET clients . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 344.3.3 Registration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 344.4 The SOAP layer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 354.4.1 SOAP message styles and encodings . . . . . . . . . . . . . . . . . . . . . . . 354.4.2 Interoperability. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 374.4.3 WebSphere MQ SOAP Uniform Resource Indicator. . . . . . . . . . . . . 394.5 SOAP/WebSphere MQ sender . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 414.6 SOAP/WebSphere MQ listener . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 424.7 Service applications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 424.8 Service deployment. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 434.9 WebSphere MQ infrastructure. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 444.9.1 The request queue and the response queue . . . . . . . . . . . . . . . . . . 444.9.2 Queue manager connections . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 444.9.3 WebSphere MQ channels . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 454.9.4 Security and error handling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 464.9.5 Advanced features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46Chapter 5. SOAP/WebSphere MQ implementation. . . . . . . . . . . . . . . . . . . 495.1 Setting up the environment and using the samples . . . . . . . . . . . . . . . . . 515.1.1 Setting the environment variable WMQSOAP HOME . . . . . . . . . . . 515.1.2 Running the amqwsetcp.cmd/sh command . . . . . . . . . . . . . . . . . . . 515.1.3 Using the Installation Verification Test to verify installation . . . . . . . 525.1.4 Executing the setupWMQSOAP.cmd/sh script . . . . . . . . . . . . . . . . . 535.2 The development process . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 535.3 SOAP formatting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 575.3.1 Specifying Remote Procedure Call-style encodingor Document-style encoding . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 585.4 The deployment process . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 595.4.1 Deployment utility syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 645.4.2 The SOAP/WebSphere MQ Universal Resource Indicator . . . . . . . . 655.4.3 Request queues . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 705.4.4 Response queues . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 725.4.5 Queue manager connection types . . . . . . . . . . . . . . . . . . . . . . . . . . 725.5 Customizing the deployment process . . . . . . . . . . . . . . . . . . . . . . . . . . . . 735.5.1 Illustrating the Microsoft .NET customized deployment . . . . . . . . . . 74ivWebSphere MQ Version 6 and Web Services

5.5.2 Illustrating the Axis customized deployment . . . . . . . . . . . . . . . . . . . 775.5.3 Using complex objects in Java and Microsoft .NET . . . . . . . . . . . . . 805.5.4 The use of mixed package names . . . . . . . . . . . . . . . . . . . . . . . . . . 815.6 The WebSphere MQ transport for SOAP listener . . . . . . . . . . . . . . . . . . . 815.6.1 Microsoft .NET listener runtime syntax . . . . . . . . . . . . . . . . . . . . . . . 835.6.2 Methods to start listeners . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 835.6.3 Stopping a listener . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 855.6.4 The role of identity context . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 855.6.5 Listener transactionality . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 865.7 Permanent and temporary dynamic response queues . . . . . . . . . . . . . . . 885.8 WebSphere MQ transport for SOAP error handling . . . . . . . . . . . . . . . . . 905.8.1 Report messages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 915.8.2 Message integrity options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 925.9 Microsoft .NET asynchronous interface . . . . . . . . . . . . . . . . . . . . . . . . . . 935.9.1 Using Microsoft .NET short-term asynchrony . . . . . . . . . . . . . . . . . . 945.10 WebSphere Application Server and CICS Transaction Serverinteroperability . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1005.10.1 WebSphere Application Server interoperation . . . . . . . . . . . . . . . 1015.10.2 CICS interoperation. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1045.11 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104Chapter 6. Security . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1076.1 Concepts of security . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1086.1.1 Security services . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1096.1.2 Security mechanisms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1106.2 Security considerations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1106.2.1 Application layer security . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1116.2.2 Transmission layer security. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1126.3 Concepts of cryptography . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1136.3.1 Cryptography. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1136.3.2 Message digest . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1156.3.3 Digital signature . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1166.3.4 Digital certificates . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1176.4 Introduction to Secure Sockets Layer . . . . . . . . . . . . . . . . . . . . . . . . . . . 1206.4.1 Concepts of Secure Sockets Layer . . . . . . . . . . . . . . . . . . . . . . . . . 1206.4.2 CipherSuites and cipherSpecs . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1216.5 Secure Sockets Layer support in WebSphere MQ . . . . . . . . . . . . . . . . . 1216.6 Working with WebSphere MQ and Secure Sockets Layer . . . . . . . . . . . 1236.6.1 Configuring WebSphere MQ for secured communication . . . . . . . . 123Part 3. Implementing synchronous Web Services . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 139Chapter 7. Environment setup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1417.1 Software prerequisites. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 142Contentsv

7.2 Software installation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1427.2.1 Installing IBM WebSphere MQ V6 . . . . . . . . . . . . . . . . . . . . . . . . . 1427.2.2 Installing Microsoft .NET Framework Redistributable V1.1 . . . . . . . 1457.2.3 Installing Microsoft .NET Software Development Kit V1.1 . . . . . . . 1457.2.4 Verifying the installation of WebSphere MQ transport for SOAP . . 1467.2.5 Installing WebSphere Application Server V6 for AIX . . . . . . . . . . . 1467.2.6 Installing Rational Application Developer V6 . . . . . . . . . . . . . . . . . 1477.3 Environment setup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1477.3.1 Basic WebSphere MQ administration . . . . . . . . . . . . . . . . . . . . . . . 151Chapter 8. Axis Web Service . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1598.1 Design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1608.2 Requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1628.3 Implementation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1628.3.1 Implementation of Web Service . . . . . . . . . . . . . . . . . . . . . . . . . . . 1638.3.2 Preparing the WebSphere MQ environment . . . . . . . . . . . . . . . . . . 1638.4 Deployment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1648.4.1 Common deployment steps . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1658.4.2 Executing a simple deployment to a local default queue manager . 1678.4.3 Executing a deployment to a local queue manager withspecific request and response queues . . . . . . . . . . . . . . . . . . . . . . 1708.4.4 Executing a deployment to a remote queue manager . . . . . . . . . . 1718.5 Error handling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1808.6 Security . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1848.7 Using the Web Service . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1868.8 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 186Chapter 9. Axis client . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1879.1 Design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1889.2 Requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1909.3 Implementation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1909.3.1 Proxy code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1909.3.2 A client for a local Axis service . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1929.3.3 A client for a remote .NET service . . . . . . . . . . . . . . . . . . . . . . . . . 2009.3.4 The WebSphere MQ environment . . . . . . . . . . . . . . . . . . . . . . . . . 2059.4 Error handling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2089.4.1 Unable to put a request to queue . . . . . . . . . . . . . . . . . . . . . . . . . . 2089.4.2 Specified request queue does not exist . . . . . . . . . . . . . . . . . . . . . 2089.4.3 Response not received . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2099.4.4 Cannot find the client-config.wsdd file. . . . . . . . . . . . . . . . . . . . . . . 2099.4.5 Incorrect message format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2109.5 Security . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2109.6 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 211viWebSphere MQ Version 6 and Web Services

Chapter 10. .NET Web Service . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21310.1 Design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21510.2 Requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21710.3 Implementation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21710.3.1 Implementation of the Web Service . . . . . . . . . . . . . . . . . . . . . . . 21710.3.2 Compiling the Web Service . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22110.4 Preparing the WebSphere MQ environment . . . . . . . . . . . . . . . . . . . . . 22210.5 Deployment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22710.5.1 Common deployment steps . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22810.5.2 Executing a simple deployment to a local defaultqueue manager. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22910.5.3 Executing a deployment to a local queue managerwith specific request and response queues . . . . . . . . . . . . . . . . . . 23010.5.4 Executing a deployment to a remote queue manager . . . . . . . . . 23210.6 The SOAP/WebSphere MQ listener . . . . . . . . . . . . . . . . . . . . . . . . . . . 23510.7 Error handling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23610.8 Security . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23910.9 Using the Web Service . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24110.10 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 241Chapter 11. .NET client . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24311.1 Design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24411.2 Requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24411.3 Implementation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24511.3.1 Proxy code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24511.3.2 Implementing .NET client to make synchronous calls. . . . . . . . . . 24611.3.3 Implementing the .NET client to make asynchronous calls. . . . . . 25211.3.4 Preparing the WebSphere MQ environment . . . . . . . . . . . . . . . . . 25611.3.5 Setup for client mode and server binding mode connection . . . . . 25811.4 Error handling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26211.5 Security . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26611.6 Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 266Chapter 12. WebSphere Application Server Web Service . . . . . . . . . . . . 26912.1 Design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 270

WebSphere MQ Version 6 and Web Services Saida Davies Craig Both Gary O’Connor Sushil Sharma Paul Slater Ope Soyannwo Jerry L Stevens Interoperable Web Services using .NET, Axis, and IBM WebSphere Application Server WebSphere MQ transport for SOAP, .NET, and