rdz workbench - cics web services
TRANSCRIPT
®
IBM Software Group
© 2009 IBM Corporation
Creating and Calling CICS Web ServicesCreating and Calling CICS Web Services
Jon Sayles, IBM Software Group, Rational EcoSystems Team
2
IBM Trademarks and Copyrights
© Copyright IBM Corporation 2007, 2008, 2009. 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.
3
Course Contributing Authors
Thanks to the following individuals, for assisting with this course: David Myers/IBM Bill Klein Reginaldo Barosa Mike Wrzinski/Sentry Insurance
4
Purpose of This Document
Course Name: COBOL Foundation Training - with RDz
Course Description: Learn the COBOL language, RDz and learn z/OS terms, concepts and development skills in this course.
Pre-requisites: Some experience in a 3rd or 4th Generation Language is expected. SQL is also recommended.
Course Length: 10 days
Topics (Agenda) for the COBOL Course Getting Started - installing and configuring RDz - and the course materials, and using Eclipse to edit COBOL COBOL General Language Rules Basic COBOL Statements Data records and table handling Debugging Programs - Note: Deep dive on using RDz for common COBOL programming errors (001, 0C4, 0C7, infinite loops, fall-thru, etc.) Input/Output and Report Writing Patterns Sequential File Match/Merge Patterns COBOL Subprograms and the Linkage Section Structured Programming Concepts and Coding Patterns Advanced Character Manipulation, COBOL Intrinsic Functions, Date and Time coding patterns, and Language Environment calls z/OS Concepts and JCL Compile/Link & Run Procs on the mainframe Indexed file Coding Patterns Sort/Merge and Master File Update Coding Patterns Accessing DB2 Data and Stored Procedures COBOL in the Real World:
– CICS - lecture only– IMS (DL/I and TM) – lecture only– Batch processing – access the IBM mainframe– Java calling COBOL– COBOL and XML Statements– SOA and COBOL - creating and calling Web Services– Web 2.0 using Rich UI
5
Course Details
Audience This course is designed for application developers who have learned or
programmed in a 3rd or 4th generation language – and who need to build leading-edge applications using COBOL and Rational Developer for System z.
Prerequisites This course assumes that the student has a basic understanding and knowledge
of software computing technologies, and general data processing terms, concepts and vocabulary.
Knowledge of SQL (Structured Query Language) is assumed for database access is assumed as well.
Basic PC and mouse-driven development skills, terms and concepts are also assumed.
Note that we will be covering RDz's mainframe-editor-compliant function key idiom in this unit
6
Unit
XML and Web Services Terms and ConceptsXML and Web Services Terms and Concepts RDz and Web Services Setting up for Web Services Creating and consuming an RDz Web Service Consuming a 3rd Party Web Service
Topics:
RDz and Services (SOA)RDz and Services (SOA)
7
Topic objectives
After completing this topic, you should be able to:Describe the foundation SOA terms and vocabulary:
Service Service Oriented Architecture Web Service
Describe the role CICS can play, in a Service Oriented ArchitectureDefine the purpose of XMLDifferentiate between:
Service WSDL XML SOAP
Describe the role RDz plays in doing work with Web Services
8
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”
ExternalWebService
WSDLRDz
Records
RDz Service
RDz Service
WSDL
RDz Interface
RDz Interface
RDz SOA for WAS, CICS, System i
At development time… 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
Deploy Web Services…To any platform Java to WAS/Tomcat/etc. COBOL to CICS, iSeries
As… A Web Service (uses SOAP) A private service (uses CICS ECI, J2C, or TCP) Other SOA runtimes when they reach critical mass
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
External Applications
Deploy Services as Web ServicesDeploy Services as Web Services
Consume external servicesConsume external services
The Promise of Services and SOA (Service Oriented Architecture)
© 2008 IBM Corporation9
At a Very High LevelAt 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:
Intermediary Function
Simple forwarding
or
Complex message transformation and protocol remapping
Passing of an agreed-to request in
message format
Return of information in the form of an agreed-to message response
© 2008 IBM Corporation10
What’s Behind This … Why Are We Talking About ThisWhat’s Behind This … Why Are We Talking About ThisOver the years our application systems have become very complicated, with tightly-coupled relationships that are often little understood.
Actual application architecture Actual application architecture map from real-life customer map from real-life customer
Changes to any part of this are …
• Difficult to determine what impact there is on other components
• Expensive to analyze, often expensive to implement
• 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.
Two basic problems:
1. Inflexible connectivity definitions (hard-coded, deeply imbedded in code)
2. Knowledge of relationships lost over time
Possible third: duplication of resources because reuse
difficult in this environment
© 2008 IBM Corporation11
A “Service” – Conceptual DefinitionA “Service” – Conceptual DefinitionA discrete set of business or technical functionality that can be identified, has a defined set of input and outputs, and is reusable
User“Consumer”
Service“Producer”Input
Output
Discrete – can be contained within a definite and known “fence”Identified -- it’s recognized as a service and people acknowledge it as a serviceDefined – the input and the outputs are known and understoodReusable – is not just a one-time thing
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
Inte
rfac
eImplementation
Exactly how the service is implemented behind the interface doesn’t really matter to the
consumer of the service
© 2008 IBM Corporation12
An Example - Currency ExchangeAn Example - Currency Exchange
IBM’s Travel Expense Reimbursement application does not do its own foreign currency conversions … it uses an external service for that:
Currency = $US?
Inte
rfac
e
Implementation$US
No
YesInternet
[ £100,$US,15-June ]
[ $196.00 ]
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
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.
Understanding what services are available, where they’re located and what interface requirements they have is a key aspect of SOA.
© 2008 IBM Corporation13
Another Example - CICS Web ServiceAnother Example - CICS Web ServiceWe’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:
CICS Web Service
Front-End
Existing CICS
Program
CICS V3.1
NetworkWeb Service
Client Program
CICS program unchanged
Appl
3270EXCI
Traditional access unaffected
New front-end allows service
oriented invocation
SOAP/HTTP
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
Inte
rfac
e
© 2008 IBM Corporation14
Service Oriented ArchitectureService Oriented Architecture
Service oriented architecture Service oriented architecture (SOA) is a business-driven IT (SOA) is a business-driven IT architectural approach that architectural approach that supports integrating the supports integrating the business as linked, repeatable business as linked, repeatable business tasks, or services.business tasks, or services.
From www.ibm.com
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 Corporation15
CICS is an Application CICS is an Application ServerServerCICS is a system that hosts applications, and provides a rich set of “services” which the applications may make use of:
CICS Services
External Data Resources“EXEC CICS” API C++ classes for CICS JCICS classes for Java
“CICS Programs”COBOL
C/C++
PL/I
AssemblerJava EJBs
CICS EJB Support(transparent mapping)
CICS
ProgramAccess
JVMs
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.
These are the “existing assets” we’re looking to “expose” as services
© 2008 IBM Corporation16
Provider vs. Requester -- CICS Can Do BothProvider vs. Requester -- CICS Can Do Both
CICS as a Web Service Provider …
We typically consider CICS as a provider of web services:
Web Service Client
Appl
CICS
But it can also be a consumer (or requester) of web services:
Appl
CICS
Web Service Client
This web service could be anywhere accessible to CICS -- inside your company or outside
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.
The case where existing (or new) CICS applications are exposed as reusable services.
External Service
© 2008 IBM Corporation17
CICS as a Web Services ProviderCICS 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
HTTP
MQ
Built-in SOAP Handler
Custom Program
CICS Transaction
CICS
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 Corporation18
CICS Web Services Development ToolsCICS Web Services Development Tools
There are two primary tools used to develop CICS web services:
1. CICS Web Service AssistantConsists 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)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 Corporation19
What’s Produced by RDz for Web ServicesWhat’s Produced by RDz for Web Services
The process of creating and defining a Web Service to CICS
z/OS System
COBOL source, including COPYBOOK of existing
CICS application
COBOL source to our new handler, which converts SOAP XML-to-COMMAREA and vice-versa
WSBINDWSBIND file, which is a binary file that contains information about the service, including the “URI MapURI Map” that triggers the execution of the pipeline and web service
RDz
Import into RDz
Run through the creation
wizardsCompile this into the CICS LOADLIB
Optional used to define the CICS pipeline entriesMore complex scenarios can
occur, of course. But this illustrates some essential elements of the process
Transfer down to RDz
Using simple drag-and-drop capability
Transferback
20
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?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 debatesExample of XML SOAP envelope
we’ll use in one of the labs
XML can be “parsed”XML is “Self Describing”Something called a “Schema Definition” (XSD) is used to tell a program what XML tags to expect.
The WSDL file (more in moment) has XSD information
If a program knows what tags to expect (the WSDL supplies this),
then the program can “parse” (extract) information from the XML.
21
“SOAP over HTTP”
The Web Service Description Language (WSDL) file …
<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> <CustNo>3</CustNo> </q0:DFHCOMMAREA> </SOAP-ENV:Body></SOAP-ENV:Envelope>
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
HTTP Protocol(TCP/IP Network)
XML File
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 SOAP input for our CICS lab
Knowing the layout is not that important to us at this point
22
The WSDL File
Where does WSDL come from? …
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
<SOAP-ENV:Body> <q0:DFHCOMMAREA> <CustNo>3</CustNo> </q0:DFHCOMMAREA></SOAP-ENV:Body>
Web Service Client
<complexType name="DFHCOMMAREA"> <sequence> <element name="CustNo"> <simpleType> <restriction base="int"/> </simpleType> </element> </sequence></complexType>
<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>
What service will return was here … removed to save space
Web Service Provider
Client knows input XML and data requirements based on this
Client knows where service is located based on this
23
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.
Web Service Client
Web Service ProviderService Program
WSDL File• Rational Application Developer• WebSphere Developer for zSeries• Other Development Tools
With WSDL, client knows where service is and how to drive it
24
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 secondThat’s .1 second1/10th of a second1/10th of a second
Any other questions about "Why Web Services"?Any other questions about "Why Web Services"?
25
Topic objectives
After having completed this topic, you now should be able to:Describe the foundation SOA terms and vocabulary:
Service Service Oriented Architecture Web Service
Describe the role CICS can play, in a Service Oriented ArchitectureDefine the purpose of XMLDifferentiate between:
Service WSDL XML SOAP
Describe the role RDz plays in doing work with Web Services
26
Unit
XML and Web Services Terms and Concepts RDz and Web ServicesRDz and Web Services Setting up for Web Services Creating and consuming an RDz Web Service Consuming a 3rd Party Web Service
Topics:
RDz and Services (SOA)RDz and Services (SOA)
27
UNIT
Topics:
RDz IntroductionRDz Introduction
• The RDz Workbench – Terms and Concepts
• Editing COBOL Programs
• Debugging COBOL Programs
Appendix – Creating a New Workstation Project
Appendix – ISPF/LPEX Editor ComparisonAppendix – ISPF/LPEX Editor Comparison
28
Service Oriented Design – Concepts Service Orientated Design is a software design paradigm that encourages the creation of functionally discrete (modular) business logic,
composed of standardized software components (logic routines and subroutines with standard interfaces)
Services are software components that: Are logically separated, along the lines of a “business service” – such as:
Rent a car – which is further de-composed into:– Reserve a vehicle – consisting of lower-level services such as:
– Confirm a location
– Confirm the customer information
– Get payment information
– Confirm customer and payment information
– Create the reservation
…
Services are formally declared with a standard network interface that allows them to be invoked by other services that only know the interface. Also, services:
May be created at various levels of business/technical granularity (i.e. low-level vs. high-level) Can be assembled/combined (“choreographed”) to create higher-level business functionality Can be deployed to any platform – independently – and called from any platform through their network interface
29
What is a Service? Network Interface Definition ““A Web Service is a network interface to programs that live on a particular machine A Web Service is a network interface to programs that live on a particular machine
implemented in such a manner that any other program (or many programs) running on any implemented in such a manner that any other program (or many programs) running on any other machine, written in any language, and running on any OS can call it.”other machine, written in any language, and running on any OS can call it.”
Additionally: Services are an abstract design pattern - they are not the same as Web Services. In fact, a service can be implemented using a number of different
technologies, including: RPCRPC (Remote Program Call) - which you implement with an RDz:
– Local Service …or…– Library call …or…– Program
DCOMDCOM (Distributed Component Object Model) RESTREST (Representational State Transfer) CORBACORBA (Common Object Request Broker) Web ServicesWeb Services – which you implement with an RDz Service part
The “network interface” for a Web Service is formally termed a WSDLWSDL WWeb SServices DDescription LLanguage
30
Creating and Consuming Services – WSDL Files and RDz Generation
WSDLWSDL is an XML document used to describe and locate Web Services. A WSDL:
Specifies the run-time location as a URL Specifies operations and data in the Web Service Is written in XML using the SOAP transport protocol
But you don’t want to: Learn XML or SOAP or… Create the WSDL files manually
You want to code COBOL, PL/I and HLASM business logic – exactly as you’ve done all along in this course
So in fact, the RDz tooling will generate all of the “plumbing” for you – when you create or consume Web Services: When you create an RDz service, the tooling generates WSDL files, so you will not need to learn XML (and other low-level languages, terms and concepts) When you consume a service, RDz generates RDz Interfaces from existing WSDL files for you – automatically
31
Reusing Existing Application Resources
Application Aggregation …
You can do this either directly or indirectly using a wrapper program:
Application Development for CICS Web ServicesSG24-7126
Communication Logic
Business Logic
Wrapper Program
HTTP
MQ
Built-in SOAP Handler
Handler Program
Pipeline
Existing Application
EXEC CICS LINK
EXEC CICS LINK
EXEC CICS LINK
CICS
Greater control over interface exposed as web service
Ability to expose multiple CICS trans as a web service
This is listed as a “best practice” in the following redbook:
If your app is not well structured (comm logic integrated with business logic) it might not be a good candidate for being exposed as a web service
32
Different Architectural Approaches to CICS and Web Services
SOAP/HTTP
SOAP/MQ
CO
MM
AR
EA
Ap
pli
ca
tio
ns
BM
S (
32
70
)A
pp
lic
ati
on
s
CICS
Web Service Client
HATS
WebSphere z/OS
1
2
Java
3
1. SOAP/HTTP to Host Access Transformation Services (HATS), an application that runs in WebSphere and provides a web service interface (or browser interface) for BMS (3270) applications in CICS
2. SOAP/HTTP or SOAP/JMS to custom web service running in WebSphere.
3. Web service interface running inside of CICS, and accessed either through CICS HTTP listener (or MQ)
EXCI
TN3270
33
To become more innovative and more competitive, companies know that To become more innovative and more competitive, companies know that education – in all forms is necessary - today more than ever.education – in all forms is necessary - today more than ever.
To help, IBM has implemented solutions that feature community-based To help, IBM has implemented solutions that feature community-based knowledge sharing - that give your developers instant, secure access to knowledge sharing - that give your developers instant, secure access to shared content, and expertise in:shared content, and expertise in: COBOL / IMS / CICS / DB2 and z/OS TechnologiesCOBOL / IMS / CICS / DB2 and z/OS Technologies Rational Developer for System z (RDz)Rational Developer for System z (RDz) Rational Asset Analyzer (RAA)Rational Asset Analyzer (RAA)
Check out the COBOL Café Check out the COBOL Café http://www-949.ibm.com/software/rational/cafe/community/cobol
And check out upcoming free, self-paced IBM training in:And check out upcoming free, self-paced IBM training in: RDz / RAA / COBOL / IMS / CICS / DB2RDz / RAA / COBOL / IMS / CICS / DB2
The COBOL Café and Rational - z/OS Product Training from IBMhttp://www-949.ibm.com/software/rational/cafe/community/cobol