Skip to main content

By clicking Submit, you agree to the developerWorks terms of use.

The first time you sign into developerWorks, a profile is created for you. Select information in your profile (name, country/region, and company) is displayed to the public and will accompany any content you post. You may update your IBM account at any time.

All information submitted is secure.

  • Close [x]

The first time you sign in to developerWorks, a profile is created for you, so you need to choose a display name. Your display name accompanies the content you post on developerworks.

Please choose a display name between 3-31 characters. Your display name must be unique in the developerWorks community and should not be your email address for privacy reasons.

By clicking Submit, you agree to the developerWorks terms of use.

All information submitted is secure.

  • Close [x]

developerWorks Community:

  • Close [x]

Build a RESTful service on CICS with PHP

Robin Fernandes (robin_fernandes@uk.ibm.com), Software Developer, IBM
Photo of Robin Fernandes
Robin Fernandes joined IBM's Java Technology Centre in Hursley, United Kingdom as Software Developer after graduating from Imperial College in 2003. His current focus is a Java-based runtime for PHP, which is used in the CA1S SupportPac and WebSphere sMash. He also regularly contributes test cases and patches to php.net and enjoys experimenting with audio software in his spare time.
Jonathan Lawrence (jlawrence@uk.ibm.com), Software Developer, IBM
Photo of Jonathan Lawrence
Jonathan Lawrence joined IBM's Java Technology Centre in Hursley, United Kingdom as a Software Developer in 2006, after 4 years in Hursley's Software Services department where he was a CICS and Cross-platform Integration Specialist. He designed the CICS integration aspects of the CA1S SupportPac.

Summary:  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.

Date:  21 Apr 2009
Level:  Intermediate PDF:  A4 and Letter (409 KB | 37 pages)Get Adobe® Reader®

Activity:  12723 views
Comments:  

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.

1 of 9 | Next

Comments



static.content.url=http://www.ibm.com/developerworks/js/artrating/
SITE_ID=1
Zone=Web development, Open source
ArticleID=383593
TutorialTitle=Build a RESTful service on CICS with PHP
publish-date=04212009
author1-email=robin_fernandes@uk.ibm.com
author1-email-cc=
author2-email=jlawrence@uk.ibm.com
author2-email-cc=