CICS in a Service Oriented Architecture Martin Cocks – cocksmar@uk.ibm.com SOA on your terms and our expertise – www.ibm.com/cics © 2007 IBM Corporation © IBM Corporation 2008. All Rights Reserved. The workshops, sessions and materials have been prepared by IBM or the session speakers and reflect their own views. They are provided for informational purposes only, and are neither intended to, nor shall have the effect of being, legal or other guidance or advice to any participant. 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. IBM shall not be responsible for any damages arising out of the use of, or otherwise related to, this presentation or any other materials. 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 the applicable license agreement governing the use of IBM software. References in this presentation to IBM products, programs, or services do not imply that they will be available in all countries in which IBM operates. Product release dates and/or capabilities referenced in this presentation may change at any time at IBM’s sole discretion based on market opportunities or other factors, and are not intended to be a commitment to future product or feature availability in any way. Nothing contained in these materials is intended to, nor shall have the effect of, stating or implying that any activities undertaken by you will result in any specific sales, revenue growth or other results. Performance is based on measurements and projections using standard IBM benchmarks in a controlled environment. The actual throughput or performance that any user will experience will vary depending upon many factors, including considerations such as the amount of multiprogramming in the user's job stream, the I/O configuration, the storage configuration, and the workload processed. Therefore, no assurance can be given that an individual user will achieve results similar to those stated here. All customer examples described are presented as illustrations of how those customers have used IBM products and the results they may have achieved. Actual environmental costs and performance characteristics may vary by customer. The following are trademarks of the International Business Machines Corporation in the United States and/or other countries. For a complete list of IBM trademarks, see www.ibm.com/legal/copytrade.shtml AIX, CICS, CICSPlex, DB2, DB2 Universal Database, i5/OS, IBM, the IBM logo, IMS, iSeries, Lotus, OMEGAMON, OS/390, Parallel Sysplex, pureXML, Rational, RACF, Redbooks, Sametime, Smart SOA, SupportPac, System i, System i5, System z , Tivoli, WebSphere, and z/OS. Java and all Java-based trademarks are trademarks of Sun Microsystems, Inc. in the United States, other countries, or both. Microsoft and Windows are trademarks of Microsoft Corporation in the United States, other countries, or both. Intel and Pentium are trademarks or registered trademarks of Intel Corporation or its subsidiaries in the United States and other countries. UNIX is a registered trademark of The Open Group in the United States and other countries. Linux is a registered trademark of Linus Torvalds in the United States, other countries, or both. Other company, product, or service names may be trademarks or service marks of others. CICS in a Service Oriented Architecture | www.ibm.com/cics Agenda CICS TS V3 and SOA Overview Pipeline and WS-* support – MTOM/XOP – WS-AT – WS-Security – WS-Trust 3 CICS in a Service Oriented Architecture | www.ibm.com/cics Web Services in CICS SOA on your terms and our expertise – www.ibm.com/cics © 2007 IBM Corporation Web Services at a glance in Version 3 CICS TS V3.1 CICS TS V3.2 The runtime support in CTS 3.1 is for Support was added for – WSDL 1.1 – WSDL 2.0 – SOAP 1.1 and SOAP 1.2 – MTOM/XOP – WS-I Basic Profile 1.1 – WS-Trust – XML 1.0 – Additional schema data mappings – WS-I Simple SOAP Binding Profile 1.0 – WS-AT 1.0 – WS-Security 1.0 • Provides batch tooling to handle generation of data mappings – Schema into (and vice-versa) • C • Pl/I • Cobol 5 CICS in a Service Oriented Architecture | www.ibm.com/cics Usage Scenarios CICS as a Service Provider using existing program (bottom up) • Existing application not changed – Existing language structure CICS as a Service Provider using new program (top down) • New application – Existing WSDL CICS as a Service Requester using a new program (top down) • New application – Existing WSDL 6 CICS in a Service Oriented Architecture | www.ibm.com/cics Web Services Enablement Styles Bottom-up Top-down New service: WSDL Existing service description WSDL Generate Existing Business App (e.g. COBOL, C, C++, PLI) 7 Generate New Business App (COBOL, C, C++, PLI) CICS in a Service Oriented Architecture | www.ibm.com/cics Meet in the middle Existing service description WSDL Map and Generate Existing Business App (COBOL, C, C++, PLI) http://www.mycics.co.uk/webservice Pipeline 1 Pipeline 2 Soap Message Pipeline 3 URIMAP 8 CICS in a Service Oriented Architecture | www.ibm.com/cics CICS Application CICS Application CICS Application CICS Application CICS Application Tooling to Runtime (the connection) • CICS provides the necessary tools and runtime for web services • A utility can generate WSDL from language structures – a bottom up approach from an existing application • A utility can generate language structures from WSDL – a top down approach to new CICS service provider or requester programs • XML to language structure (e.g. COMMAREA) conversion and vice versa at runtime • The link between the utilities and the runtime is via the WSBind file 9 CICS in a Service Oriented Architecture | www.ibm.com/cics Web Services (the complete picture) top down Tools IDE tools WSDL bottom up CICS provided utilities WSBind file lang. structure CICS Web service Runtime Service Requester pipeline conversion Business logic CICS 10 CICS in a Service Oriented Architecture | www.ibm.com/cics Runtime Scenarios • CICS can be the service provider – traditional situation. CICS is the server in a client/server scenario. A client sends a request in to CICS. • CICS can be the service requester – this is where CICS is the client in the client/server scenario. CICS is sending a request to execute a webservice to an external service provider. 11 CICS in a Service Oriented Architecture | www.ibm.com/cics Provider overview Conversion Convert to SOAP Body commarea Inbound format and invoke app Pipeline CICS application SOAP Body Outbound Convert to SOAP and pass to pipeline 12 CICS in a Service Oriented Architecture | www.ibm.com/cics program Requester overview Conversion CICS Application Convert to SOAP Body Outbound Program SOAP and pass to pipeline EXEC CICS INVOKE Pipeline WEBSERVICE SOAP Body Inbound Convert to commarea format and pass to application 13 CICS in a Service Oriented Architecture | www.ibm.com/cics QoS handlers and support 14 CICS in a Service Oriented Architecture | www.ibm.com/cics MTOM/XOP support in CICS • CICS now supports MTOM/XOP over HTTP transport • MTOM handler added at transport end of pipeline – Handles packaging and unpackaging of MIME root and attachments – Attachments are stored as containers of data type BIT – List of attachments is stored in a separate container • Pipeline usually processes message in XOP format instead of XML – Application handler works with attachments instead of base64Binary data 15 CICS in a Service Oriented Architecture | www.ibm.com/cics XOP processing modes Two ways in which XOP messages can be processed: • Direct mode – Pass message along pipeline in XOP format, using application handler logic to deal directly with attachments. – This is the normal mode which fully exploits the MTOM/XOP optimization. • Compatibility mode – Pass message along pipeline in standard XML format, converting to and from XOP format as part of the MTOM handler processing. – This mode is used to tolerate the use of MTOM/XOP when WS-security or XML validation is being used. 16 CICS in a Service Oriented Architecture | www.ibm.com/cics CPU per msg Requester Web Services with binary data and MTOM/XOP 225 200 175 150 125 100 75 50 25 0 0 250 500 750 Binary element size in K CTS31 17 CTS32 CTS32 MTOM/XOP CICS in a Service Oriented Architecture | www.ibm.com/cics 1000 MTOM/XOP Performance summary • Performance improvements with binary data and MTOM/XOP – CPU benefits for binary data • 53% less CPU for a 1 meg binary element compared with CICS TS V3.1 – CPU benefits for MTOM/XOP • MTOM/XOP gives performance benefits for binary data > 4K • 88% less CPU for a 1 meg binary element compared with nonMTOM/XOP • 94% less CPU for a 1 meg binary element compared with CICS TS V3.1 – Reduced network transmission size • 25% less data transmitted for a 1 meg binary element using MTOM/XOP 18 CICS in a Service Oriented Architecture | www.ibm.com/cics WS-AT Support • Allows CICS to be both a Coordinator and Participant in distributed 2 phase commit over Web Services • Bi-directional • Uses underlying CICS Recovery manager services 19 CICS in a Service Oriented Architecture | www.ibm.com/cics WS-AT 1.0 Example W ebSphereApplicationServer V6 CICSTS 80.27.16.238 129.35.161.66 W SATFaultPort 8.Com m itted Coordinator RSRequester pipeline (DFHW SATR) 6.Prepared Registration and Protocol services (DFHPIRS) 2.Register RegistrationCoordinator 3.RegisterResponse Port 5.Prepare 7.Com m it DFHW SATX RSProvider pipeline (DFHW SATP) Servlet JSPs EJBs 20 1. InvokeW Sw ith CoordinationContext DFHW SATH 4. W Sresponse W SProvider pipeline CICS in a Service Oriented Architecture | www.ibm.com/cics W ebservice provider app WS-Security 1.0 Overview • Support for – XML Encryption – XML Digital Signature – Identity mapping and asserted identity • Uses ICSF for crypto hardware support • Requires XML Toolkit for C 21 CICS in a Service Oriented Architecture | www.ibm.com/cics WS-Trust Support • Establishing an identity for a web service request in CICS to run under. – This means an 8 character userid – External / client identities are often not part of the same security database or even of the same type. • Adding credentials to a message when CICS is sending a Web Services request such that it runs under the correct identity in providing system – CICS only has an 8 character view of the identity and no access to the password – External systems often use other formats 22 CICS in a Service Oriented Architecture | www.ibm.com/cics WS-Trust Schematic STS (Change Security Tokens) SAML assertion RACF userid token SOAP Envelope SOAP Header Header Block Header Block SOAP Body Body sub-element 23 Pipeline (Trust Handler) SOAP Envelope SOAP Header Header Block Header Block SOAP Body Body sub-element Body sub-element Body sub-element Body sub-element Body sub-element CICS in a Service Oriented Architecture | www.ibm.com/cics WS-Security – Provider Basic Authentication L S S h+ +A ut +A ut h CTS31 CTS32 +S S L S O A P 14 12 10 CPU 8 millisecs 6 per msg 4 2 0 24 CICS in a Service Oriented Architecture | www.ibm.com/cics WS-Trust – Provider and Requester 4.5 4 3.5 3 CPU 2.5 millisecs 2 per msg 1.5 1 0.5 0 No Trust SSL Requester 25 Trust STS SSL Provider CICS in a Service Oriented Architecture | www.ibm.com/cics SSL Application Bindings WSDL/Schema 26 CICS in a Service Oriented Architecture | www.ibm.com/cics WSDL definition type • Web Services Description Language • XML based language to describe an interface of a service • WSDL comprises of – – – – – – – 27 type portType message operation binding service port message abstract service interface definition portType operation Input Output how the service is implemented binding location of service service CICS in a Service Oriented Architecture | www.ibm.com/cics port Bottom up approach in CICS TS V3 •An existing CICS application is to be exposed as a web service – Language structure(s) need to be extracted from the source code – If the COMMAREA is very complex, it may be necessary to write a ‘wrapper program’ to map the COMMAREA into a form which can be handled by the CICS tooling. – Use a CICS supplied batch procedure (DFHLS2WS) to convert language structure(s) to WSDL. • The language structures can be COBOL, PL/I, C or C++ • Publish the generated WSDL, using WSRR for example. • A file called the WSBind file is also produced. 28 CICS in a Service Oriented Architecture | www.ibm.com/cics Batch Processing (DFHLS2WS) Language structure(s) JCL to specify parameters 29 05 WSTEST2. 10 Wrapper. 15 SOME-DATA 15 USER-DETAILS. 20 FIRST-NAME 20 LAST-NAME 20 AGE PIC X(79). PIC X(10). PIC X(10). PIC 9(3) DISPLAY. //JAVAPROG EXEC DFHLS2WS, LOGFILE=/u/myuserid/wsbind/ls2ws.log WSDL=/u/myuserid/wsdl/temp.wsdl PGMNAME=PETS URI=/reqpetsURI PGMINT=CHANNEL CONTID=mycontname LANG=COBOL WSBIND=/u/myuserid/wsbind/reqpet.wsbind PDSLIB=//MYUSERID.COPYBOOK REQMEM=INPUT01 CICS in a Service Oriented Architecture | www.ibm.com/cics WSBind file WSDL The previous foil showed an overview of the batch process when starting from a language structure (or several language structures) and converting them into a WSDL document. The WSDL generated by the CICS tooling will always be Document literal. The WSBind file is also produced. 30 CICS in a Service Oriented Architecture | www.ibm.com/cics Top down approach in CICS TS V3 •A supplied WSDL definition of a web service is to be implemented as a CICS application – Use CICS supplied batch procedure (DFHWS2LS) to convert the WSDL into a language structure. • Use the generated language structure in a CICS application program. • A file called the WSBind file is also produced. 31 CICS in a Service Oriented Architecture | www.ibm.com/cics Batch Processing (DFHWS2LS) Schema JCL to specify parameters 32 <xsd:element name="SOME-MESSAGE" nillable="false"> <xsd:simpleType> <xsd:restriction base="xsd:string"> <xsd:length value="79"/> <xsd:whiteSpace value="preserve"/> </xsd:restriction> </xsd:simpleType> </xsd:element> <xsd:element name="NAME" nillable="false"> <xsd:simpleType> <xsd:restriction base="xsd:string"> <xsd:length value="20"/> <xsd:whiteSpace value="preserve"/> </xsd:restriction> </xsd:simpleType> </xsd:element> //JAVAPROG EXEC DFHWS2LS, LOGFILE=/u/myuserid/wsbind/wstest1.log WSDL=/u/myuserid/wsdl/wstest1.wsdl BINDING=WSTEST1HttpSoapBinding PGMNAME=WSTEST1 URI=/wstest1 PGMINT=COMMAREA LANG=COBOL WSBIND=/u/myuserid/wsbind/wstest1.wsbind PDSLIB=//MYUSERID.COPYBOOK REQMEM=WS1IN CICS in a Service Oriented Architecture | www.ibm.com/cics WSBind file Language structure(s) Meet in the middle • Pure ‘top down’ or ‘bottom up’ will not be suitable in all situations. • In such situations, a wrapper program may provide a solution – if the language structure uses data types not supported by the utility tools • a wrapper program may be used to map commarea to a supported data type – when there are unnecessary fields in the language structure which you do not want to expose externally • a wrapper program can be used to hide unnecessary fields – when an existing piece of WSDL is to be used with an existing program • the WSDL and the program may not match exactly. A wrapper program could perform some intermediate mappings. 34 CICS in a Service Oriented Architecture | www.ibm.com/cics Where a wrapper program fits in SOAP body 35 Conversion Wrapper Program Change the SOAP to a COMMAREA Change the COMMAREA as required CICS in a Service Oriented Architecture | www.ibm.com/cics Business Logic Thank you 36 CICS in a Service Oriented Architecture | www.ibm.com/cics