Welcome!

Microservices Expo Authors: Elizabeth White, Pat Romanski, Kevin Jackson, John Katrick, Gopala Krishna Behara

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:

EXEC CICS GET CONTAINER
CONTAINER (‘DFHWS-DATA      ‘)
CHANNEL (‘FLTDTLS-CHANEL  ‘)
INTO (‘....DFHPI00000000000')
FLENGTH (20)
NOHANDLE

The above result in HEX:

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

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.

EXEC CICS GET CONTAINER
CONTAINER (‘DFHPI00000000000')
CHANNEL (‘FLTDTLS-CHANEL  ‘)
INTO (‘....DFHPI00000000001.... DFHPI00000000002.... DFHPI00000000003....'...)
FLENGTH (360)
NOHANDLE

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.

EXEC CICS GET CONTAINER
CONTAINER (‘DFHPI00000000001')
CHANNEL (‘FLTDTLS-CHANEL  ‘)
INTO (‘SPICE'...)
FLENGTH (255)
NOHANDLE

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

EXEC CICS GET CONTAINER
CONTAINER (‘DFHPI00000000002')
CHANNEL (‘FLTDTLS-CHANEL  ‘)
INTO (‘2008-06-28T19:45:00+05:30')
FLENGTH (32)
NOHANDLE

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;
---------+---------+---------+--
ORDER_ID  PRODUCT_CODE  PRODUCT_DESC  PRODUCT_PRICE  PRODUCT_QTY
---------+---------+---------+--
DSNE610I NUMBER OF ROWS DISPLAYED IS 0
DSNE616I STATEMENT EXECUTION WAS SUCCESSFUL, SQLCODE IS 100
---------+---------+---------+--

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:

---------+---------+---------+---------
SELECT * FROM UCHB002.ORDER_DETAIL;
---------+---------+---------+---------
ORDER_ID  PRODUCT_CODE  PRODUCT_DESC   PRODUCT_PRICE  PRODUCT_QTY
---------+---------+---------+---------
1  Soap    Dove      55.00     10
1  Oil     SunFlower 99.00      2
DSNE610I NUMBER OF ROWS DISPLAYED IS 2
DSNE616I STATEMENT EXECUTION WAS SUCCESSFUL, SQLCODE IS 100
---------+---------+---------+---------

Conclusion
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.

References

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
DevOps promotes continuous improvement through a culture of collaboration. But in real terms, how do you: Integrate activities across diverse teams and services? Make objective decisions with system-wide visibility? Use feedback loops to enable learning and improvement? With technology insights and real-world examples, in his general session at @DevOpsSummit, at 21st Cloud Expo, Andi Mann, Chief Technology Advocate at Splunk, explored how leading organizations use data-driven DevOps to close th...
The past few years have brought a sea change in the way applications are architected, developed, and consumed—increasing both the complexity of testing and the business impact of software failures. How can software testing professionals keep pace with modern application delivery, given the trends that impact both architectures (cloud, microservices, and APIs) and processes (DevOps, agile, and continuous delivery)? This is where continuous testing comes in. D
"WineSOFT is a software company making proxy server software, which is widely used in the telecommunication industry or the content delivery networks or e-commerce," explained Jonathan Ahn, COO of WineSOFT, 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.
In a recent post, titled “10 Surprising Facts About Cloud Computing and What It Really Is”, Zac Johnson highlighted some interesting facts about cloud computing in the SMB marketplace: Cloud Computing is up to 40 times more cost-effective for an SMB, compared to running its own IT system. 94% of SMBs have experienced security benefits in the cloud that they didn’t have with their on-premises service
Gaining visibility in today’s sprawling cloud infrastructure is complex and laborious, involving drilling down into tools offered by various cloud services providers. Enterprise IT organizations need smarter and effective tools at their disposal in order to address this pertinent problem. Gaining a 360 - degree view of the cloud costs requires collection and analysis of the cost data across all cloud infrastructures used inside an enterprise.
There is a huge demand for responsive, real-time mobile and web experiences, but current architectural patterns do not easily accommodate applications that respond to events in real time. Common solutions using message queues or HTTP long-polling quickly lead to resiliency, scalability and development velocity challenges. In his session at 21st Cloud Expo, Ryland Degnan, a Senior Software Engineer on the Netflix Edge Platform team, will discuss how by leveraging a reactive stream-based protocol,...
SYS-CON Events announced today that Synametrics Technologies will exhibit at SYS-CON's 22nd International Cloud Expo®, which will take place on June 5-7, 2018, at the Javits Center in New York, NY. Synametrics Technologies is a privately held company based in Plainsboro, New Jersey that has been providing solutions for the developer community since 1997. Based on the success of its initial product offerings such as WinSQL, Xeams, SynaMan and Syncrify, Synametrics continues to create and hone inn...
The goal of Microservices is to improve software delivery speed and increase system safety as scale increases. Microservices being modular these are faster to change and enables an evolutionary architecture where systems can change, as the business needs change. Microservices can scale elastically and by being service oriented can enable APIs natively. Microservices also reduce implementation and release cycle time and enables continuous delivery. This paper provides a logical overview of the Mi...
Our work, both with clients and with tools, has lead us to wonder how it is that organizations are handling compliance issues in the cloud. The big cloud vendors offer compliance for their infrastructure, but the shared responsibility model requires that you take certain steps to meet compliance requirements. Which lead us to start poking around a little more. We wanted to get a picture of what was available, and how it was being used. There is a lot of fluidity in this space, as in all things c...
The notion of improving operational efficiency is conspicuously absent from the healthcare debate - neither Obamacare nor the newly proposed GOP plan discusses the impact that a step-function improvement in efficiency could have on access to healthcare (through more capacity), quality of healthcare services (through reduced wait times for patients) or cost (through better utilization of scarce, expensive assets).
Some people are directors, managers, and administrators. Others are disrupters. Eddie Webb (@edwardawebb) is an IT Disrupter for Software Development Platforms at Liberty Mutual and was a presenter at the 2016 All Day DevOps conference. His talk, Organically DevOps: Building Quality and Security into the Software Supply Chain at Liberty Mutual, looked at Liberty Mutual's transformation to Continuous Integration, Continuous Delivery, and DevOps. For a large, heavily regulated industry, this task ...
Modern software design has fundamentally changed how we manage applications, causing many to turn to containers as the new virtual machine for resource management. As container adoption grows beyond stateless applications to stateful workloads, the need for persistent storage is foundational - something customers routinely cite as a top pain point. In his session at @DevOpsSummit at 21st Cloud Expo, Bill Borsari, Head of Systems Engineering at Datera, explored how organizations can reap the bene...
The past few years have seen a huge increase in the amount of critical IT services that companies outsource to SaaS/IaaS/PaaS providers, be it security, storage, monitoring, or operations. Of course, along with any outsourcing to a service provider comes a Service Level Agreement (SLA) to ensure that the vendor is held financially responsible for any lapses in their service which affect the customer’s end users, and ultimately, their bottom line. SLAs can be very tricky to manage for a number ...
"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.
As many know, the first generation of Cloud Management Platform (CMP) solutions were designed for managing virtual infrastructure (IaaS) and traditional applications. But that's no longer enough to satisfy evolving and complex business requirements. In his session at 21st Cloud Expo, Scott Davis, Embotics CTO, explored how next-generation CMPs ensure organizations can manage cloud-native and microservice-based application architectures, while also facilitating agile DevOps methodology. He expla...
Admiral Calcote - also known as Lee Calcote (@lcalcote) or the Ginger Geek to his friends - gave a presentation entitled Characterizing and Contrasting Container Orchestrators at the 2016 All Day DevOps conference. Okay, he isn't really an admiral - nor does anyone call him that - but he used the title admiral to describe what container orchestrators do, relating it to an admiral directing a fleet of container ships. You could also say that they are like the conductor of an orchestra, directing...
The dynamic nature of the cloud means that change is a constant when it comes to modern cloud-based infrastructure. Delivering modern applications to end users, therefore, is a constantly shifting challenge. Delivery automation helps IT Ops teams ensure that apps are providing an optimal end user experience over hybrid-cloud and multi-cloud environments, no matter what the current state of the infrastructure is. To employ a delivery automation strategy that reflects your business rules, making r...
"We started a Master of Science in business analytics - that's the hot topic. We serve the business community around San Francisco so we educate the working professionals and this is where they all want to be," explained Judy Lee, Associate Professor and Department Chair at Golden Gate University, 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.
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...
The “Digital Era” is forcing us to engage with new methods to build, operate and maintain applications. This transformation also implies an evolution to more and more intelligent applications to better engage with the customers, while creating significant market differentiators. In both cases, the cloud has become a key enabler to embrace this digital revolution. So, moving to the cloud is no longer the question; the new questions are HOW and WHEN. To make this equation even more complex, most ...