Microservices Expo Authors: Elizabeth White, Pat Romanski, Scott Davis, Stackify Blog, Kelly Burford

Related Topics: Microservices Expo

Microservices Expo: Article

Developing a CICS-Based Web Service

CICS as a service provider and consumer

Web services have opened opportunities to integrate the applications at an enterprise level irrespective of the technology they have been implemented in. IBM's CICS transaction server for z/OS v3.1 can support web services. It can help expose existing applications as web services or develop new functionality to invoke web services.

One of the commonly used protocols for CICS web services is SOAP for CICS. It enables the communication of applications through XML. It supports as a service provider and service consumer independent of platform and language. SOAP for CICS enables CICS applications to be integrated with the enterprise via web services as part of lowering the cost of integration and retaining the value of the legacy application. SOAP for CICS also comes along with the implementation encoder and decoder. This article describes two cases where CICS acts as a service provider and also as a consumer for complex datatype objects. CICS SOAP 1.2 is the SOAP implementation and encoding and decoding is done by the PIPELINE programs. Two exclusive PIPELINEs need to be defined, one for the provider and the other for the consumer.

IBM provides CICS Web Services Assistants, namely, DFHLS2WS and DFHWS2LS. The DFHLS2WS utility takes a language data structure used by the service provider and generates the WSDL and WSBIND files. The WSBIND file is used at runtime to convert a SOAP body to a language data structure and vice-a-versa. The DFHWS2LS takes the WSDL provided by a service and generates the language data structure and a WSBIND file. Complex data types are handled by these utilities. The languages supported by these utilities include COBOL, Java, C++, and PL1. The web services are registered in the CICS region using the PIPELINE SCAN command (see Figure 1).

CICS as a Service Consumer - Handling Multiple Result Sets
The application is a Flight Inquiry. The input screen has the Departure and Arrival cities along with the departure date. This invokes a Java web service, which does a query on an Oracle database to retrieve all the flights between the cities on that date. The result is a varying list of flights between different city pairs.

The high-level steps followed in the coding are:

  1. Received the WSDL file for the service to be consumed. Appendix A has the WSDL.
  2. Used the Web services assistant, DFHWS2LS, to create the request and response copybooks using the WSDL. Set the PGMINT parameter to CHANNEL as we do not know the size of the data being returned. This will help overcome the COMMAREA size limitations in case we receive a huge amount of data. Appendix B has these copybooks.
  3. Did a PIPELINE SCAN on the pipeline, which has been defined to be used when the CICS is a web service consumer.
  4. Coded a program to capture inputs and pass them to a wrapper that invokes the web service and creates a TSQ containing the response received. Display program reads the TSQ and displays data.

Figure 2 is the input screen shot of the sample application.

Extracting values from the result sets received is a little tricky. The first GET CONTAINER gives us the number of result sets received; two in the example below and the name of a container, which further contains container names of the result sets. The next GET CONTAINER gets us all the container names, which store the actual values. Then we loop through these container name and value pairs to get finally to the data to be displayed.

The first GET CONTAINER gets the name of the container which has container names containing the data:

INTO (‘....DFHPI00000000000')

The above result in HEX:

CONTAINER (X'C4C6C8E6E260C4C1E3C1404040404040')
CHANNEL (X'C6D3E3C4E3D3E260C3C8C1D5C5D34040')
INTO (X'00000002C4C6C8D7C9F0F0F0F0F0F0F0F0F0F0F0') 2 total result sets received
FLENGTH (X'00000014')

The second GET CONTAINER gets all the container names containing actual data. There is no demarcation between result sets. The container names are just a bunch of sequenced names.

CONTAINER (‘DFHPI00000000000')
INTO (‘....DFHPI00000000001.... DFHPI00000000002.... DFHPI00000000003....'...)

The above maps to the complete XML output as shown below. Each of the DFHPI* is the container name of the actual data element, e.g., <airways>, <arrivalDate>, <capacity>, etc., in the file

We then loop through  the GET CONTAINERS to get actual data. In our case, each result set contains nine elements (airways, arrivalDate, capacity, departureDate, flightFrom, flightNo, flightTo, flightTravelCode and price, refer to the XML output, between <return> </return>). Hence one loop goes through nine GET CONTAINERS.

CONTAINER (‘DFHPI00000000001')

The above maps to the XML output of <airways>SPICE</airways>

CONTAINER (‘DFHPI00000000002')
INTO (‘2008-06-28T19:45:00+05:30')

The above maps to the XML output  <arrivalDate>2008-06-28T19:45:00+05:30</arrivalDate> and so on and so forth till end of data.

This way of using complex datatype objects of an advanced Java application can be used by a legacy system as a consumer of service will have a greater advantage of leveraging the concept of web services for legacy systems.

Listing 1 is the XML output from the SOAPSonar web-services testing tool with the inputs mentioned in Figure 2. Please note that this is just to understand the output structure. When the communication happens directly between the provider and the consumer, we do not see this output.

Figure 3 is the output screenshot of the sample application.

CICS as a Service Provider - Creation of an Order ID
The application stores order details in a DB2 database on the mainframe and creates an order ID for the orders received through the external application(s). This service on the z/OS mainframe is tested through a Java application in the Windows environment. The result is an Order ID (unique number) of the order been placed.

The high-level steps followed in the coding are:

  1. Created the language structure (COBOL request copybook) for the service to be developed.
  2. Used the web services assistant, DFHLS2WS, to create the WSDL. Used the PGMINT =COMMAREA. Appendix C has the copybook.
  3. Scanned the inbound pipeline, which has been defined to be used when the CICS is a web service provider.
  4. Coded a program to receive input from the service consumer, inserts the order details and a unique order ID in the database, and returns the order UD to the service consumer.

The following are the steps involved in the web service testing. Rows from the DB2 table ORDER_DETAIL:

---------+---------+---------+--SELECT * FROM UCHB002.ORDER_DETAIL;

The XML output from the SOAPSonar web services testing tool with the above inputs (see Figure 4). Please note that this is just to understand the output structure when the communication happens directly between the provider and the consumer (see Figure 5).

Rows in the DB2 table ORDER_DETAIL:

1  Soap    Dove      55.00     10
1  Oil     SunFlower 99.00      2

With the increasing demand for integration of enterprise applications with complex data type structures that have an advantage for manipulating large and complex data, developers have looked at various options one of which is web services. In this article, we have developed a CICS-based program to act as web service provider and consumer using complex data types.


More Stories By GVB Subrahmanyam

GVB Subrahmanyam an Application Developer, Lead, Project Manager, Development Manager and Delivery Manager in a wide variety of business applications as part of an IT service provider. He focuses on Development, Delivery and Sustenance of IT Applications in Supply Chain/Insurance/Banking/Finance. Albeit most of his projects are Java-based assignments, he is technology agnostic.

In his current role, Subrahmanyam is working as a solution provider for Commercial Healthcare, Insurance, banking and Financial systems with Mahindra Satyam. He is also TOGAF certified Enterprise Architect and IBM certified Ratioanal Software Architect.

GVB Subrahmanyam has an M.Tech. and Ph.D. from IIT Kharagpur in the area of Chemical Technology, India and MS in Software Systems from BITS Pilani. He is also a PMI certified PMP. He attended one year of the Executive Program in Business Management(EPBM) from IIM Calcutta.

More Stories By Sree Kusumanchi

Sree Kusumanchi is lead architect with the Legacy Transformation Group in Satyam Computer Services and has a masters in technology from BITS Pilani.

More Stories By Girish Mokhasi

Girish Mokhasi is technical architect for Legacy Transformation Group in Satyam Computer Services.

Comments (0)

Share your thoughts on this story.

Add your comment
You must be signed in to add a comment. Sign-in | Register

In accordance with our Comment Policy, we encourage comments that are on topic, relevant and to-the-point. We will remove comments that include profanity, personal attacks, racial slurs, threats of violence, or other inappropriate material that violates our Terms and Conditions, and will block users who make repeated violations. We ask all readers to expect diversity of opinion and to treat one another with dignity and respect.

@MicroservicesExpo Stories
The cloud era has reached the stage where it is no longer a question of whether a company should migrate, but when. Enterprises have embraced the outsourcing of where their various applications are stored and who manages them, saving significant investment along the way. Plus, the cloud has become a defining competitive edge. Companies that fail to successfully adapt risk failure. The media, of course, continues to extol the virtues of the cloud, including how easy it is to get there. Migrating...
You know you need the cloud, but you’re hesitant to simply dump everything at Amazon since you know that not all workloads are suitable for cloud. You know that you want the kind of ease of use and scalability that you get with public cloud, but your applications are architected in a way that makes the public cloud a non-starter. You’re looking at private cloud solutions based on hyperconverged infrastructure, but you’re concerned with the limits inherent in those technologies.
For DevOps teams, the concepts behind service-oriented architecture (SOA) are nothing new. A style of software design initially made popular in the 1990s, SOA was an alternative to a monolithic application; essentially a collection of coarse-grained components that communicated with each other. Communication would involve either simple data passing or two or more services coordinating some activity. SOA served as a valid approach to solving many architectural problems faced by businesses, as app...
It has never been a better time to be a developer! Thanks to cloud computing, deploying our applications is much easier than it used to be. How we deploy our apps continues to evolve thanks to cloud hosting, Platform-as-a-Service (PaaS), and now Function-as-a-Service. FaaS is the concept of serverless computing via serverless architectures. Software developers can leverage this to deploy an individual "function", action, or piece of business logic. They are expected to start within milliseconds...
Some journey to cloud on a mission, others, a deadline. Change management is useful when migrating to public, private or hybrid cloud environments in either case. For most, stakeholder engagement peaks during the planning and post migration phases of a project. Legacy engagements are fairly direct: projects follow a linear progression of activities (the “waterfall” approach) – change managers and application coders work from the same functional and technical requirements. Enablement and develo...
Gone are the days when application development was the daunting task of the highly skilled developers backed with strong IT skills, low code application development has democratized app development and empowered a new generation of citizen developers. There was a time when app development was in the domain of people with complex coding and technical skills. We called these people by various names like programmers, coders, techies, and they usually worked in a world oblivious of the everyday pri...
While some developers care passionately about how data centers and clouds are architected, for most, it is only the end result that matters. To the majority of companies, technology exists to solve a business problem, and only delivers value when it is solving that problem. 2017 brings the mainstream adoption of containers for production workloads. In his session at 21st Cloud Expo, Ben McCormack, VP of Operations at Evernote, discussed how data centers of the future will be managed, how the p...
As DevOps methodologies expand their reach across the enterprise, organizations face the daunting challenge of adapting related cloud strategies to ensure optimal alignment, from managing complexity to ensuring proper governance. How can culture, automation, legacy apps and even budget be reexamined to enable this ongoing shift within the modern software factory? In her Day 2 Keynote at @DevOpsSummit at 21st Cloud Expo, Aruna Ravichandran, VP, DevOps Solutions Marketing, CA Technologies, was jo...
From manual human effort the world is slowly paving its way to a new space where most process are getting replaced with tools and systems to improve efficiency and bring down operational costs. Automation is the next big thing and low code platforms are fueling it in a significant way. The Automation era is here. We are in the fast pace of replacing manual human efforts with machines and processes. In the world of Information Technology too, we are linking disparate systems, softwares and tool...
DevOps is good for organizations. According to the soon to be released State of DevOps Report high-performing IT organizations are 2X more likely to exceed profitability, market share, and productivity goals. But how do they do it? How do they use DevOps to drive value and differentiate their companies? We recently sat down with Nicole Forsgren, CEO and Chief Scientist at DORA (DevOps Research and Assessment) and lead investigator for the State of DevOps Report, to discuss the role of measure...
Is advanced scheduling in Kubernetes achievable?Yes, however, how do you properly accommodate every real-life scenario that a Kubernetes user might encounter? How do you leverage advanced scheduling techniques to shape and describe each scenario in easy-to-use rules and configurations? In his session at @DevOpsSummit at 21st Cloud Expo, Oleg Chunikhin, CTO at Kublr, answered these questions and demonstrated techniques for implementing advanced scheduling. For example, using spot instances and co...
The nature of test environments is inherently temporary—you set up an environment, run through an automated test suite, and then tear down the environment. If you can reduce the cycle time for this process down to hours or minutes, then you may be able to cut your test environment budgets considerably. The impact of cloud adoption on test environments is a valuable advancement in both cost savings and agility. The on-demand model takes advantage of public cloud APIs requiring only payment for t...
DevOps is under attack because developers don’t want to mess with infrastructure. They will happily own their code into production, but want to use platforms instead of raw automation. That’s changing the landscape that we understand as DevOps with both architecture concepts (CloudNative) and process redefinition (SRE). Rob Hirschfeld’s recent work in Kubernetes operations has led to the conclusion that containers and related platforms have changed the way we should be thinking about DevOps and...
"As we've gone out into the public cloud we've seen that over time we may have lost a few things - we've lost control, we've given up cost to a certain extent, and then security, flexibility," explained Steve Conner, VP of Sales at Cloudistics,in this SYS-CON.tv interview at 20th Cloud Expo, held June 6-8, 2017, at the Javits Center in New York City, NY.
These days, APIs have become an integral part of the digital transformation journey for all enterprises. Every digital innovation story is connected to APIs . But have you ever pondered over to know what are the source of these APIs? Let me explain - APIs sources can be varied, internal or external, solving different purposes, but mostly categorized into the following two categories. Data lakes is a term used to represent disconnected but relevant data that are used by various business units wit...
With continuous delivery (CD) almost always in the spotlight, continuous integration (CI) is often left out in the cold. Indeed, it's been in use for so long and so widely, we often take the model for granted. So what is CI and how can you make the most of it? This blog is intended to answer those questions. Before we step into examining CI, we need to look back. Software developers often work in small teams and modularity, and need to integrate their changes with the rest of the project code b...
"I focus on what we are calling CAST Highlight, which is our SaaS application portfolio analysis tool. It is an extremely lightweight tool that can integrate with pretty much any build process right now," explained Andrew Siegmund, Application Migration Specialist for CAST, in this SYS-CON.tv interview at 21st Cloud Expo, held Oct 31 – Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA.
"Cloud4U builds software services that help people build DevOps platforms for cloud-based software and using our platform people can draw a picture of the system, network, software," explained Kihyeon Kim, CEO and Head of R&D at Cloud4U, in this SYS-CON.tv interview at 21st Cloud Expo, held Oct 31 – Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA.
Kubernetes is an open source system for automating deployment, scaling, and management of containerized applications. Kubernetes was originally built by Google, leveraging years of experience with managing container workloads, and is now a Cloud Native Compute Foundation (CNCF) project. Kubernetes has been widely adopted by the community, supported on all major public and private cloud providers, and is gaining rapid adoption in enterprises. However, Kubernetes may seem intimidating and complex ...
DevOps is often described as a combination of technology and culture. Without both, DevOps isn't complete. However, applying the culture to outdated technology is a recipe for disaster; as response times grow and connections between teams are delayed by technology, the culture will die. A Nutanix Enterprise Cloud has many benefits that provide the needed base for a true DevOps paradigm. In their Day 3 Keynote at 20th Cloud Expo, Chris Brown, a Solutions Marketing Manager at Nutanix, and Mark Lav...