Skip to main content

skip to main content

developerWorks  >  Web development | Open source  >

Build a RESTful service on CICS with PHP

developerWorks
Page 1 of 10 Go to the next page

Document options
PDF format - Fits A4 and Letter

PDF - Fits A4 and Letter
400 KB (37 pages)

Get Adobe® Reader®

Sample code


My developerWorks needs you!

Connect to your technical community


Rate this tutorial

Help us improve this content


Level: Intermediate

Robin Fernandes (robin_fernandes@uk.ibm.com), Software Developer, IBM
Jonathan Lawrence (jlawrence@uk.ibm.com), Software Developer, IBM

21 Apr 2009

CICS® Transaction Server® (TS) is a powerful transaction manager designed for rapid, high-volume processing. SupportPac CA1S uses technology from IBM WebSphere® sMash to enhance CICS TS with PHP scripting capabilities and Representational state transfer (REST)-related features. This tutorial shows how you can use PHP to quickly and easily work with CICS programs and expose them on the Web. If you are a PHP developer, find out how you can use your skills to interact with enterprise assets in CICS; if you are a CICS developer, see how PHP provides a simple and agile way to manipulate your existing resources.

Before you start

This tutorial shows how you can use CICS SupportPac CA1S to quickly expose CICS COMMAREA programs on the Web with PHP—a simple and powerful language that is ideally suited to rapid Web development. You will create a Web service that uses REST and JavaScript Object Notation (JSON), ensuring that it can easily be consumed by a variety of clients, such as Asynchronous JavaScript and XML (Ajax) front ends, other Web services, and mash-ups.

The example CICS COMMAREA program provided with this tutorial (see Download) is a simple library application written in COBOL. It holds a list of books in a VSAM file to which entries can be added or removed, and allows books to be marked as borrowed or returned.

In this tutorial you will:

  • Set up the library program on your CICS system.
  • Learn how to invoke CICS COMMAREA programs from PHP.
  • Learn about the features in CA1S that simplify the creation of RESTful Web services.
  • Expose the library program as a RESTful Web service

Prerequisites

To get the most out of this tutorial, you should have a basic understanding of the PHP language and some familiarity with CICS administration or CICS program development. To read up on CICS, visit the CICS TS 3.2 Information Center. You may also want to read through the introduction section of the CA1S user guide, which briefly outlines the purpose of CA1S and the principles of REST. (See Resources for links to these guides and documentation.)

CICS environment

To compete the tutorial, you will need a CICS environment that meets the prerequisites listed on the CA1S download page.

Download and install the CA1S SupportPac following the instructions in the CA1S user guide. Verify your installation by invoking the HelloCICS.php script as described in the guide.

Tools

  • Any text editor is sufficient to write PHP scripts. You can use an IDE such as Eclipse PDT.
  • You will need a mechanism to transfer PHP scripts from your workstation to your CICS server, such as an FTP client or the Target Management plug-in for Eclipse.
  • To test your RESTful Web services, you will need a simple REST client that can issue GET, POST, PUT, and DELETE HTTP requests, such as the Poster add-on for Mozilla Firefox.

Downloads for all tools described can be found in Resources.



Back to top



Page 1 of 10 Go to the next page