® IBM Software Group Web Services – An Introduction Leigh Compton – Certified IT Specialist – CICS, Web Services and Java David Myers – RDz PLM © 2009 IBM Corporation IBM Trademarks and Copyrights © Copyright IBM Corporation 2007, 2008, 2009, 2010. All rights reserved. The information contained in these materials is provided for informational purposes only, and 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, these materials. Nothing contained in these materials 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 these materials to IBM products, programs, or services do not imply that they will be available in all countries in which IBM operates. This information is based on current IBM product plans and strategy, which are subject to change by IBM without notice. Product release dates and/or capabilities referenced in these materials 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. IBM, the IBM logo, the on-demand business logo, Rational, the Rational logo, and other IBM Rational products and services are trademarks or registered trademarks of the International Business Machines Corporation, in the United States, other countries or both. Other company, product, or service names may be trademarks or service marks of others. 2 The Promise of Services and SOA (Service Oriented Architecture) Services are the driving business system design paradigm of the day. Services – Generated by RDz provide a cross platform language for business oriented development Services and SOA are based on the concept of “Service Oriented Design” At development time… Leverage external web services… Service Interfaces Represent external web services Are created via import from WSDL Allow the RDz developer to stay within the context of the RDz programming model Focus on the business logic Implement SOA design elements: services and interfaces Leverage existing business developers for new SOA development Ignore deployment targets/technology while coding/testing RDz SOA for WAS, CICS, System i Deploy Web Services… To any platform RDz Service Java to WAS/Tomcat/etc. COBOL to CICS, iSeries RDz Interface RDz Records As… A Web Service (uses SOAP) A private service (uses CICS ECI, J2C, or TCP) Other SOA runtimes when they reach critical mass RDz Service Deploy Services as Web Services WSDL External Applications 3 Consume external services W S D L External Web Service At a Very High Level What we’re ultimately getting at here is a decoupling of application requester from the application provider. And the placement of an intermediary function to make things more flexible and dynamic: Passing of an agreedto request in message format Intermediary Function Simple forwarding or Complex message transformation and protocol remapping Return of information in the form of an agreed-to message response © 2008 IBM Corporation 4 What’s Behind This … Why Are We Talking About This Over the years our application systems have become very complicated, with tightly-coupled relationships that are often little understood. Actual application architecture map from real-life customer Changes to any part of this are … Two basic problems: 1. Inflexible connectivity definitions (hard-coded, deeply imbedded in code) • Difficult to determine what impact there is on other components 2. Knowledge of relationships lost over time • Expensive to analyze, often expensive to implement Possible third: duplication of resources because reuse difficult in this environment • Delays often result in missed opportunities Two objectives: eliminate tight (hard-coded) interconnections, and create a way for one program to dynamically seek, find, and bind to another. © 2008 IBM Corporation 5 A “Service” – Conceptual Definition A discrete set of business or technical functionality that can be identified, has a defined set of input and outputs, and is reusable Discrete – can be contained within a definite and known “fence” Identified -- it’s recognized as a service and people acknowledge it as a service Defined – the input and the outputs are known and understood Reusable – is not just a one-time thing Service Input Interface “Producer” User “Consumer” Implementation Output Exactly how the service is implemented behind the interface doesn’t really matter to the consumer of the service There’s nothing revolutionary about this. What’s different is that we’re coming to a point where improvements in technology have allowed us to do this better than before: • • • • Settled on a universal and common networking protocol -- TCP/IP Networking bandwidth is increasingly available, cheap and reliable The idea of “industry standards” has matured and is embraced rather than resisted Java as a platform-unaware language has opened up a new world of interoperability © 2008 IBM Corporation 6 An Example - Currency Exchange IBM’s Travel Expense Reimbursement application does not do its own foreign currency conversions … it uses an external service for that: No [ £100,$US,15-June ] Internet Yes $US Interface Currency = $US? [ $196.00 ] Implementation Could IBM have coded an internal subroutine to do currency conversions? Sure. But very good converters exist on the web and in this case IBM took advantage of them. For this to work, several things need to be in place: • IBM application needs to know about the service and where it is located • IBM application needs to know the interface requirements: parameters, sequence, format Understanding what services are available, where they’re located and what interface requirements they have is a key aspect of SOA. © 2008 IBM Corporation 7 Another Example - CICS Web Service We’ve not really defined what a “web service” is … but for now be aware that CICS has the ability to front-end existing CICS programs with a web service interface … “exposing” the CICS program as a service: Traditional access unaffected Appl EXCI 3270 CICS V3.1 Interface SOAP/HTTP Web Service Client Program Network CICS Web Service Front-End Existing CICS Program CICS program unchanged New front-end allows service oriented invocation Key point is that a traditional CICS program can be turned into a message based “service” which can then be used by “service consumers” in your network © 2008 IBM Corporation 8 Service Oriented Architecture From www.ibm.com Service oriented architecture (SOA) is a business-driven IT architectural approach that supports integrating the business as linked, repeatable business tasks, or services. An exact definition is probably not all that important. It's more important to understand: • The concept of a “service” • The implied value of a loosely coupled “service” rather than a tightly coupled connection to another application’s interface … flexibility • That “SOA” is a path towards the use of more and more services in your I/T architecture … not a “thing” or an “all-at-once” proposition • That there’s more to it than just services. © 2008 IBM Corporation 9 CICS is an Application Server CICS is a system that hosts applications, and provides a rich set of “services” which the applications may make use of: CICS “CICS Programs” COBOL Program Access PL/I Assembler “EXEC CICS” API EJBs Java C++ classes for CICS C/C++ These are the “existing assets” we’re looking to “expose” as services JVMs JCICS classes for Java CICS EJB Support (transparent mapping) External Data Resources CICS Services There are many ways to access programs running in CICS -- 3270 terminal, EXCI or EPI, RMI/IIOP, MQ, HTTP. Our focus here is going to be accessing via Web Services. © 2008 IBM Corporation 10 Provider vs. Requester -- CICS Can Do Both We typically consider CICS as a provider of web services: CICS Web Service Client Appl The case where existing (or new) CICS applications are exposed as reusable services. But it can also be a consumer (or requester) of web services: External Service CICS Appl This web service could be anywhere accessible to CICS -inside your company or outside Web Service Client We’ll focus on the top one for the most part. The concepts you’ll see are mostly applicable to both environments. See “CICS Web Services Guide” (SC34-6458) for more. CICS as a Web Service Provider … © 2008 IBM Corporation 11 CICS as a Web Services Provider Three basic requirements of being a Web Services provider: Ability to receive the SOAP request Standard ways: SOAP/HTTP or SOAP/JMS Ability to read and understand the contents of the SOAP request XML parser along with implementation of the “WS-basic” standards Ability to act upon the request This is the “behind the interface” implementation we’ve shown before CICS HTTP MQ Built-in SOAP Handler Custom Program CICS Transaction This is defined within something called a “Pipeline,” which is a structure within CICS that invokes your customized program(s). This is what does the mapping of XML to application data structure and invokes the CICS transaction. © 2008 IBM Corporation 12 CICS Web Services Development Tools There are two primary tools used to develop CICS web services: 1. CICS Web Service Assistant Consists of a set of JCL batch utilities that generate program components DFHLS2WS – Transforms a language structure into a Web Service Binding File and a Web Service Description (WSDL). Use this to put a web service front end on an existing application. DFHWS2LS - Generates a Web Service binding file from a Web Service description (WSDL). This utility also generates a language structure that you can use in your application programs. Use this to create a new CICS application based on a WSDL, or to enable CICS to be a web service requester 2. Rational Developer for System z (RDz) An Eclipse-based tool for zSeries development (not just web services), it does what CICS Web Service Assistant does with additional flexibility and capabilities. RDz is the more powerful alternative. CICS Web Service Assistant should only be used for basic web services enablement and when Eclipse expertise is lacking © 2008 IBM Corporation 13 What’s Produced by RDz for Web Services The process of creating and defining a Web Service to CICS z/OS System RDz Import into RDz COBOL source, including COPYBOOK of existing CICS application Run through the creation wizards More complex scenarios can occur, of course. But this illustrates some essential elements of the process COBOL source to our new handler, which converts SOAP XML-to-COMMAREA and viceversa Compile this into the CICS LOADLIB WSBIND file, which is a binary file that contains information about the service, including the “URI Map” that triggers the execution of the pipeline and web service Optional used to define the CICS pipeline entries © 2008 IBM Corporation 14 The Importance of XML in Web Services You will see that XML is the common mechanism to exchange information in a web services environment. What is XML, and why is it valuable? <SOAP-ENV:Envelope> <SOAP-ENV:Body> <q0:DFHCOMMAREA> <CustNo>3</CustNo> </q0:DFHCOMMAREA> </SOAP-ENV:Body> </SOAP-ENV:Envelope> A series of “tags” that mark the beginning and end of blocks of XML It holds both the data, as well as description of the data <CustNo> provides an indicator of what the data is; “3” is the actual data. It is both machine readable and human readable, which makes things relatively easy to understand Contrast with bit-format protocols, where bits within bytes meant certain things. Machine readable yes; human readable less so. Characters use “Unicode” encoding, which means it’s universally understood As opposed to the old EBCDIC vs. ASCII debates Example of XML SOAP envelope we’ll use in one of the labs XML is “Self Describing” XML can be “parsed” Something called a “Schema Definition” (XSD) is used to tell a program what XML tags to expect. If a program knows what tags to expect (the WSDL supplies this), then the program can “parse” (extract) information from the XML. The WSDL file (more in moment) has XSD information 15 “SOAP over HTTP” You’ll frequently hear this phrase. What it’s referring to is the passing of an XML document -- a SOAP “envelope” -- using the HTTP protocol Web Service Client Web Service Provider XML File HTTP Protocol (TCP/IP Network) <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:q0="http://www.WBCSCUSTI.com/schemas/WBCSCUSTIInterface" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <SOAP-ENV:Body> <q0:DFHCOMMAREA> The SOAP input for our CICS lab <CustNo>3</CustNo> </q0:DFHCOMMAREA> Knowing the layout is not that important to </SOAP-ENV:Body> us at this point </SOAP-ENV:Envelope> The key is that the client program knew what the provider expected -- what data elements and what XML tags to use. How did it know that? It had the WSDL file. The Web Service Description Language (WSDL) file … 16 The WSDL File WSDL contains information about the service -- where it’s located, what parameters it takes as input, what it gives back as output, what XML tags to use, etc. It is sometimes known as a “bindings file”. It can be long and complicated … what follows is a boiled-down snippet to show essence <complexType name="DFHCOMMAREA"> <sequence> <element name="CustNo"> <simpleType> <restriction base="int"/> Client knows input XML and </simpleType> data requirements based on this </element> </sequence> Client knows where service </complexType> What service will return was here … removed to save space is located based on this <wsdl:service name="WBCSCUSService"> <wsdl:port binding="tns:WBCSCUSBinding" name="WBCSCUSPort"> <soap:address location="http://mig.null.washington.ibm.com:12301/WBCSCUST"/> </wsdl:port> </wsdl:service> Web Service Client <SOAP-ENV:Body> <q0:DFHCOMMAREA> <CustNo>3</CustNo> </q0:DFHCOMMAREA> </SOAP-ENV:Body> Web Service Provider Where does WSDL come from? … 17 WSDL File is a Product of RDz You could hand-code the WSDL. More likely you’ll use a development tool (in our case, RDz) to create the web service, and RDz will also produce the WSDL. Service Program Web Service Provider With WSDL, client knows where service is and how to drive it WSDL File • Rational Application Developer • WebSphere Developer for zSeries • Other Development Tools 18 Web Service Client That's all well and good, but what about performance? http://listserv.uga.edu/cgi-bin/wa?A2=ind0908&L=CICS-L&D=0&P=30338 That’s .1 second 1/10th of a second Any other questions about "Why Web Services"? 19 Service Oriented Architecture Model – and IMS Monitoring/Event Management IMS Database Web Services Services Data Services/Messaging J2EE/JCA (EJB) SQL/ XQuery/XML SOAP/J2EE J2EE/JCA (EJB) Data Abstraction Data IMS DB Governance Security Process/Orchestration Legacy Rep IMS App Source: Linthicum Group 20 IMS On Demand Overview Web service clients Solutions Solutions DLI WID RAD Model Utility Java/J2EE Client Java dev IMS WebSphere SAP Client Application developer Direct SOAP IMS SOAP Gateway WDz TCP /IP Java class Library Database DL/I Java class Library SQL XQuery DL/I CICS Developer DB2 SP/CICS Java class Library DLI DLI Model Utility Model Utility 21 Java /J2EE Developer IMS DB Resource Adapter Database manager IMS APP Java class Library WebSphere ODBA /DRA Client Developer SOAP Transaction manager IMS Connect .NET Client Web Service IMS TM Resource Adapter MFS Web Services Direct Database access Developers DB2 Developer TCP/IP Access to IMS z/OS CONNECT IMS TM App 22 IMS DB CTRL Architecture Foundation - IMS Connect A capability that provides connectivity support between TCP/IP applications and IMS transactions – Integrated into IMS V9 Configured on a z/OS server Benefits and Value Supports TCP/IP sockets access to IMS transactions and commands Provides a general purpose and structured interface Provides a strategic base for new connection technologies: Operations Manager – IMS Control Center IMS SOAP Gateway MFS Web Services IMSB Web Server program COMTI Visual Basic PowerBuilder Java Applet BROWSER ... Web Server Cobol Assembler C/C++ Java TCP/IP IMS Connect VTAM Websphere 23 IMSA IMS TM Resource Adapter z/OS WebSphere TM RA CONNECT App IMS TM App 24 IMS DB CTRL J2EE/JCA Architecture J2EE Application Server Container-Component Contract Application Component Application Contract CCI (common client Interface) Connection Management System Contracts Transaction Management SPI (service provider interface) Security Management Resource Adapter EIS-specific interface EIS 25 IMS TM Resource Adapter … Supports the development of J2EE applications, Web services, and business processes that can interface with IMS Connect Development component – Rational Developer for System z – RDz Runtime component – Must be installed into an application server, e.g., WebSphere PLI C IMPORT IMS SERVICE COBOL IMS RESOURCE ADAPTER Export Installed Applications Appl.EAR DEPLOY & TEST Unit Test Environment RDz J2C Connection Factory IMS RESOURCE ADAPTER imsico.RAR WebSphere Java Applet BROWS ER IMS TCP/IP (supplied with IMS Connect) WebSphere Application Server IMS Connect Toolkits that generate web services, EJBs, JSP, etc. for IMS, CICS, DB2 26 Learn more at: IBM Rational software Rational launch announcements Rational Software Delivery Platform Accelerate change & delivery Deliver enduring quality Enable enterprise modernization Ensure Web security & compliance Improve project success Manage architecture Manage evolving requirements Small & midsized business Targeted solutions Rational trial downloads developerWorks Rational Leading Innovation IBM Rational TV IBM Business Partners IBM Rational Case Studies © Copyright IBM Corporation 2010. All rights reserved. The information contained in these materials is provided for informational purposes only, and 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, these materials. Nothing contained in these materials 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 these materials 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 these materials 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. IBM, the IBM logo, Rational, the Rational logo, Telelogic, the Telelogic logo, and other IBM products and services are trademarks of the International Business Machines Corporation, in the United States, other countries or both. Other company, product, or service names may be trademarks or service marks of others. 27 27