Cics Web 2.0 With Atom Feeds And Php
Post on 14-Jan-2015
2632 Views
Preview:
DESCRIPTION
Transcript
© 2009 IBM Corporation
CICS Transaction Server V4.1
CICS and Web 2.0
Tom Grieve
tgrieve@uk.ibm.com
CICS Transaction Server V4.1
© 2009 IBM Corporation2
Outline
What is Web 2.0 and what is a RESTful SOA?
Why is this relevant to CICS and CICS applications
How to use Atom to make CICS information available to more end-users
CICS Transaction Server V4.1
© 2009 IBM Corporation3
Outline
What is Web 2.0 and what is a RESTful SOA?
Why is this relevant to CICS and CICS applications
How to use Atom to make CICS information available to more end-usersWhat is Web 2.0 and
what is a RESTful SOA?
CICS Transaction Server V4.1
© 2009 IBM Corporation4
What is Web 2.0*?
Simple to use Simple to access
AJAX• Highly Interactive• Browser invoked services
JSON / XML / ATOM • Information exchange• JavaScript Friendly
REST• Easily invoked• HTTP-Centric Patterns
* A term coined by Tim O‘Reilly (http://www.oreillynet.com/pub/a/oreilly/tim/news/2005/09/30/what-is-web-20.html )
CICS Transaction Server V4.1
© 2009 IBM Corporation5
What is Web 2.0?
From Wikipedia...– Web 2.0, a phrase coined by O'Reilly Media in 2003 and
popularized by the first Web 2.0 conference in 2004, refers to a perceived second generation of web-based communities and hosted services — such as social-networking sites, wikis and folksonomies — which facilitate collaboration and sharing between users. O'Reilly Media titled a series of conferences around the phrase, and it has since become widely adopted.
– Although the term suggests a new version of the World Wide Web, it does not refer to an update to Web technical specifications, but to changes in the ways systems developers have used the web platform. According to Tim O'Reilly, "Web 2.0 is the business revolution in the computer industry caused by the move to the internet as platform, and an attempt to understand the rules for success on that new platform."
– (continued)
CICS Transaction Server V4.1
© 2009 IBM Corporation6
What is Web 2.0?
– Advocates of the concept suggest that technologies such as weblogs, social bookmarking, wikis, podcasts, RSS feeds (and other forms of many-to-many publishing), social software, Web APIs, Web standards and online Web services imply a significant change in web usage. As used by its supporters, the phrase "Web 2.0" can also refer to one or more of the following:•the transition of web sites from isolated information silos to
sources of content and functionality, thus becoming computing platforms serving web applications to end-users;
•a social phenomenon embracing an approach to generating and distributing Web content itself, characterized by open communication, decentralization of authority, freedom to share and re-use, and "the market as a conversation";
•enhanced organization and categorization of content, emphasizing deep linking;
•a rise in the economic value of the Web, possibly surpassing the impact of the dot-com boom of the late 1990s.
CICS Transaction Server V4.1
© 2009 IBM Corporation7
Accessibility for Developers
A RESTful Web service is formed like a sentence – it simplifies how developers access services Verb = HTTP Action (GET, POST, PUT, DELETE) Noun = the URI of the Service (the document) Adjective = MIME type of the resulting document
CICS Transaction Server V4.1
© 2009 IBM Corporation8
RESTful SOA
A RESTful SOA is an instance of SOA that uses concepts from the Web as the primary service architecture
– Limiting choices to make it easier to implement a SOA
– Primarily uses REST to represent and access services
– Data is encoded as JSON or XML (including XML schemas like ATOM)
– May use alternate approaches like JSON-RPC when appropriate
– Supports Rich User Interfaces built using AJAX
Key aspects of building an effective RESTful SOA
– Take advantage of your existing infrastructure wherever possible
– Use well-established, ubiquitous technologies for scalability, performance and security
– Build rich UI’s that run in any commodity browser
– Make content simple and human readable
CICS Transaction Server V4.1
© 2009 IBM Corporation9
Where can a RESTful SOA apply?
When building Widgets for use in Mashups or RIA’s, or building feeds (ATOM or RSS) for use in a browser or by an aggregator
When you want to make assets available to the web– In a form that it can be parsed by the widest range of
technologies available– Where it may be consumed on either the client or server side
When the asset you are exposing is naturally resource-oriented
CICS Transaction Server V4.1
© 2009 IBM Corporation10
What’s the philosophical difference?
The key motivator of a RESTful SOA is its simplicity and its ubiquity
– It’s about delivering content in the simplest possible way– HTTP is available everywhere; it’s like the air around us
With WS-* It’s not the body that matters, it’s the headers
– WS-Security is about choice in the decision of encryption, identity tokens and digital signatures
– WS-Addressing is about transport-neutral mechanisms of describing addresses
– Even the WS-I standards are about allowing maximum flexibility within a fully agreed-upon framework of standards
You might want to choose WS* where you don’t have direct control of all the pipes.
– WS-ReliableMessaging and SOAP over JMS are about choice in how you obtain qualities of service
CICS Transaction Server V4.1
© 2009 IBM Corporation11
Merging Enterprise SOA and RESTful SOA
If you take the route of developing for both Enterprise SOA and RESTful SOA then you can take advantage of two separate content pools– Services generated inside your enterprise– Services generated outside the enterprise
This gives you the best of both worlds and allows you to take advantage of all the communities served by your businessServices fromInside the Enterprise
Services fromoutside the Enterprise
New Content andNew ways to reachYour communities
CICS Transaction Server V4.1
© 2009 IBM Corporation12
Attributes and advantages of a RESTful SOA
Simplicity
– Many decisions pre-made, constrained choices
• Fixed protocol (HTTP)• Fixed encryption model (HTTPs)• Fixed identity token exchange (Basic-Auth or standard HTTP
schemes)
Ubiquity
– Use the HTTP infrastructure and other technologies like JavaScript that already exist
Effortless use of services
– Single, well-understood programming model (Javascript)
– Lots of examples on the web
• Copy-cut-and-paste programming to use services– Someone should be able to use a RESTful SOA Service without
knowing they’re doing it!
Cacheability, Scalability, Testability, Securability, Navigability
CICS Transaction Server V4.1
© 2009 IBM Corporation13
Intuitive User Experience – using AJAX
In the typical web application, each request causes a complete refresh of the browser page
An Ajax application begins the same way.
After the initial page loads, Javascript code retrieves additional data in the background and updates only specific sections of the page
AJAX is the acronym for Asynchronous JavaScript and XML AJAX forces you to think about discrete services Gives you a bottoms-up approach to defining services that can reveal new things about your enterprise
Service
CICS Transaction Server V4.1
© 2009 IBM Corporation14
XML, JSON and ATOM
XML is the standard representation for message format in RESTful services
– The key difference from SOAP is that the XML represents only the body of a message– Thus a RESTful service will carry as its content only a simple, human-readable
document that represents the “noun” of the service
JSON is an alternate standard format for succinct communication with AJAX clients
– The vast majority of the clients of a RESTful service will be written in JavaScript– In recognition of that, JSON (JavaScript Object Notation) allows for rapid exchange of
JavaScript objects, but also in a simple, human-readable format– JSON is built up from a collection of name-value pairs and ordered lists of values
ATOM is a key XML specification for content syndication
– ATOM allows for better support for podcasting, updating, and extension than RSS provided
– ATOM is also human readable and is easy to understand and parse
CICS Transaction Server V4.1
© 2009 IBM Corporation15
Extend your business processes
For your services to be useful they have to be reused; one of the key promises of a SOA is that it enables your enterprise for BPM
Many businesses act as though their business processes end at the corporate firewall; to take advantage of your business communities you need to extend your business processes out to your communities.
This entails several aspects
– Make sure that you can expose your processes (and their results) to your communities
– Make sure that you can consume RESTful services in your business processes
This is possible today through existing tools and RESTful approaches; but can be made simpler in future products and product releases
CICS Transaction Server V4.1
© 2009 IBM Corporation16
WebSphere sMash for quickly delivering Web 2.0 applications, and enabling mashups.
WebSphere sMash
Improves developer productivity and efficiency through the support of dynamic scripting languages (Groovy and PHP)
• Leverages Web 2.0 technologies for service invocation, service composition and data interchange • Visual tools for developers to build Widgets for use in Lotus Mashups
CICS Transaction Server V4.1
© 2009 IBM Corporation17
Outline
What is Web 2.0 and what is a RESTful SOA?
Why is this relevant to CICS and CICS applications
How to use Atom to make CICS information available to more end-users Why is this relevant to CICS
and CICS applications
CICS Transaction Server V4.1
© 2009 IBM Corporation18
What does this mean to CICS?
As far as CICS goes there are at least two ways that Web 2.0 can intersect with it:
1.Customers wanting to employ CICS apps as part of their Web 2.0 solution (CICS Customer Web 2.0)
2.Use of Web 2.0 technologies in the CICS portfolio of products and tools (CICS TS Web 2.0)
Elements of Web 2.0 that we ought to consider:– Enabling CICS apps in Mashups - typically browser or portal based
aggregations– Enabling CICS apps to be Web Feeds– Encouraging the building of RESTful access to CICS applications
• Using REST in our external APIs (e.g. systems management)
CICS Transaction Server V4.1
© 2009 IBM Corporation19 IBM Confidential 04/10/23
URLs, RESTful and tagging
“Clean and meaningful URLs”
– For everything!
REST
– REpresentational State Transfer - See http://en.wikipedia.org/wiki/Representational_State_Transfer
– How the Web has always worked...
• HTTP POST|GET|PUT|DELETE are all the verbs you'll ever need• Everything else is a resource – with a representation of its state
Tagging
– “Remembering in public”
– Associating audience-defined terms to things so thatdynamic collections are formed
CICS Transaction Server V4.1
© 2009 IBM Corporation20
An example of CICS supporting a customer Web 2.0 application
CICS applications as Atom Feeds– Atom feeds provide access to data. CICS apps typically add
some business level value over the top of raw database or file records.
– Examples of what a feed could publish include:
• New entries in file or table• Contents of a queue• ... what else?
These in turn could have business value as new orders, new customers....– An illustration of what could be useful would be to provide
an Atom feed that represents a Temp Stg queue. A CICS app then has a very simple way to populate a feed - simply write to the queue.
CICS Transaction Server V4.1
© 2009 IBM Corporation21 IBM Confidential 04/10/23
An example of CICS supporting a Web 2.0 application
CICSCOBOL
APP
EXEC CICS WRITEQ TS
Atom(HTTP)
CICS TS v3
CICSAtom
Server
SimpleHTTP
application
CICS Transaction Server V4.1
© 2009 IBM Corporation22
WEB 2.0 and ATOM
ATOM feeds are the basis for other Web 2.0 technology– Mashups, feed aggregators, blogs all support ATOM
Replaces previous RSS syndication standard
Comes in two flavours:– RFC4287 - Atom Syndication Format (2005)
• Feeds and Entries• Targetted at producing feeds
– RFC5023 - Atom Publishing Protocol (2007)• Services and Collections• Targetted to creating and updating resources
CICS Transaction Server V4.1
© 2009 IBM Corporation23
Using Atom Publishing Protocol to discover services and data
AtomService
Workspace
Collection
Entry
<?xml version="1.0" encoding='utf-8'?><service xmlns="http://purl.org/atom/app#"> <workspace title="My blog" > <collection title="My blog entries" href="http://example.org/reilly/main" > <accept>entry</accept> </collection> <collection title="Pictures" href="http://example.org/reilly/pic" > <accept>image/*</accept> </collection> </workspace></service>
Service Document
Finding and filtering
Returning refs to 'real' things
<feed xmlns="http://www.w3.org/2005/Atom"xml:base="http://example.org/blog/entries">
<id>http://example.org/blog/entries</id><title>My Blog Entries</title><updated>2006-08-12T13:40:03Z</updated><link rel="self" href="/blog/entries" /><link href="http://blog.example.org" /><entry>
<id>tag:example.org,2006:/blog/entries/1</id><title>Atom-Powered Robots Run Amok</title><link href="http://example.org/2003/12/13/atom03"/><link rel="edit"href="http://example.org/blog/entries/1" /><updated>2006-08-12T13:40:03Z</updated><author><name>James</name></author><summary>Some text.</summary>
</entry><entry> ...</entry> ...
</feed>
CICS Transaction Server V4.1
© 2009 IBM Corporation24
Create, Read, Update, Delete with Atom
HTTP defines the operations– POST to create entries and specific resources
– GET to read
• Service Documents• Collections• Specific resources
– PUT to update entries and specific resources
– DELETE to delete entries and specific resources
CICS Transaction Server V4.1
© 2009 IBM Corporation25
Create, Read, Update, Delete with Atom
HTTP defines the operations– POST to create entries and specific resources queue
elements, records, rows, application objects,...
– GET to read
• Service Documents• Collections of entries on a queue, records in a file, rows in a
table, application defined objects, ...• Specific resources queue elements, records, rows, application
objects,...
– PUT to update entries and specific resources queue elements, records, rows, application objects,...
– DELETE to delete entries and specific resources queue elements, records, rows, application objects,...
CICS Transaction Server V4.1
© 2009 IBM Corporation26
Coping with lots of data
GET against a feed representing your customer database might return a very large number of entries!
Atom employs a simple, but powerful, paging scheme....
<feed xmlns="http://www.w3.org/2005/Atom"><link rel="next" href="http://example.org/entries/60" /> ! URI for the next page<link rel="previous"href="http://example.org/entries/20" /> ! URI for the prev page...<entry> ... </entry><entry> ... </entry>...</feed>
Of course, the collection could be a subset defined by the URI
http://winmvs2c.hursley.ibm.com/atom/cicsfile/filea?s=66666
CICS Transaction Server V4.1
© 2009 IBM Corporation27
Outline
What is Web 2.0 and what is a RESTful SOA?
Why is this relevant to CICS and CICS applications
How to use Atom to make CICS information available to more end-users How to use Atom to make
CICS information available to more end-users
CICS Transaction Server V4.1
© 2009 IBM Corporation28
CICS and Atom on Transaction Server V3 To get early exposure, a SupportPac (CA8K)
– Runs on CICS TS 3.1 and 3.2
– Category 2
– Released 20th March 2008
– Prereqs:
• PTF UK34429 on CICS TS V3.1 or PTF UK34459 on CICS TS V3.2, for APAR PK58721
• PTF UA31443 on z/OS V1.7, for APAR OA16303, or a later release of z/OS – See http://www.ibm.com/support/docview.wss?fdoc=aimcics&rs=1083&uid=swg24018619
Peter Havercan gave a teleconference entitled "Extending SOA and CICS with Web 2.0" on 11 June 2008. This teleconference explained how, with SupportPac CA8K, you can use existing CICS Web support facilities to deliver Atom feeds containing data from CICS.
– To listen to the replay, go to http://www.ibm.com/software/os/systemz/telecon/11jun/index.html
CICS Transaction Server V4.1
© 2009 IBM Corporation29
Design for SupportPac CA8K
►The resource to be published is specified in an XML configuration file
►Only a portion of the CICS resource needs to be exposed as an ATOM entry For example a single file record, or queue item,
or a range of records or items
►The selection of the resource portion is identified by the URL querystring:http://winmvs2c.hursley.ibm.com/atom/cicsfile/filea?s=66666
►Any XML parsing exploits the z/OS XML System Services
CICS Transaction Server V4.1
© 2009 IBM Corporation30
Design for SupportPac CA8K (cont)
PIPELINE:CONFIGFILE(/x/config/filea)
<handler_parameter_list> <atomfeed xmlns="http://www.ibm.com/software/htp/cics/atompipe"> <atom:feed xmlns:atom="http://www.w3.org/2005/Atom"> <atom:id>tag:ibm.com/cics/702134</atom:id> <atom:title>My CICS feed</atom:title> <atom:link rel=“self” href=“/atom/cicsfile/filea”> <atom:entry> <atom:id>tag:ibm.com/cics/702138</atom:id> <atom:title>Title for the entry</atom:title> </atom:entry> </atom:feed> </atomfeed> <cics_resource name="FILEA" type="file" key="NUMB"> <layout>...</layout> </cics_resource> </handler_parameter_list>
URIMAP:PATH(atom/*)USAGE(PIPELINE)
TCPIPSERVICE:PROTOCOL(HTTP)IPADDRESS(nnn...)
CICS Transaction Server V4.1
© 2009 IBM Corporation31
Mapping XML to resource data
►Data from Atom is character-based data imbedded within XML
►Data in the CICS resource is in binary or packed-decimal form
►Bi-directional conversion is needed
►Similar to the problem that is already addressed in existing CICS Web Services support
CICS Transaction Server V4.1
© 2009 IBM Corporation32
Mapping XML to CICS resource binary data
►The CICS resource layout is described by a DFDL specification within the pipeline configuration file
►DFDL (Data Format Description Language) Superset of XML schema language
Being specified by Open Grid Forum working group
See http://forge.gridforum.org/projects/dfdl-wg/
CICS Transaction Server V4.1
© 2009 IBM Corporation33
Example of DFDL specification
<xs:element name="sbyte" type="xs:byte" dfdl:length="1“
/>
<xs:element name="comment" type="xs:string" dfdl:length="16“
/>
<xs:element name="packnum" type="xs:decimal" dfdl:length="16"
xs:fractionDigits="2"
dfdl:decimalFormat="packed"
dfdl:decimalSigned="false“
/>
CICS Transaction Server V4.1
© 2009 IBM Corporation34
Implementing “Read for Update”
►READ for UPDATE cannot hold a lock over an HTTP GET/PUT sequence, so a “conditional PUT” has been implemented:
►GET returns an HTTP Etag header Etag value uniquely identifies the response instance returned In this implementation, it is a checksum value
►PUT request sends the same Etag value in anIf-Match header If resource has changed, HTTP response 412 (Precondition
failed) is returned, and update is not performed
CICS Transaction Server V4.1
© 2009 IBM Corporation35
Requirement for D-type APAR
Current PIPELINE support is SOAP oriented
– HTTP methods GET and DELETE diagnosed as errors
• Pipeline expects Content-Type header– MEDIATYPE of HTTP response is assumed to be SOAP
• Needs new DFHMEDIATYPE container– HTTP status code cannot be set within the handler application
• Needs new DFHHTTPSTATUS container– Also need to recognize JavaScript and JSON mediatypes as text
• for correct codepage conversion– Fixes for above will be available in CICS APAR PK58721
CICS Transaction Server V4.1
© 2009 IBM Corporation36
ATOM support in CICS TS 4.1
http://winmvs2c.hursley.ibm.com/atom/cicsfile/filea
URIMAPPATH(atom/*)USAGE(ATOM)
ATOMSERVICEATOMTYPE(FEED)STATUS(ENABLED)RESOURCENAME(FILEA)RESOURCETYPE(FILE)BINDFILECONFIGFILE
XSDBIND file <cics:atomservice type="feed“ <cics:feed cics:window="window-size"> <cics:resource name=“FILEA" type=“FILE“/> . . . <atom:feed xmlns:atom="http://www.w3.org/2005/Atom"> . . . . <atom:content cics:resource="cics-resource-name" cics:type="cics-resource-type"/> </atom:feed> </cics:atomservice>
CICS Transaction Server V4.1
© 2009 IBM Corporation37
AtomService CONFIGFILE
Specify the CICS resource attributes of the feed
<cics:atomservice type=“typevalue”>
– Root element for an Atom configuration file and the type of Atom document• feed, collection, service, category
For feed documents: <cics:feed cics:window="window-size">
• Specify the number of entries that CICS is to return in each feed document
– <cics:resource> name="cics-resource-name" type="cics-resource-type“>
• Specify name and type of CICS resource to be published– tsqueue, file
• Or provide a program to create data from any source– DB2, custom data store etc.
– <cics:fieldnames> • Identify the CICS resource field names that provide items of metadata
CICS Transaction Server V4.1
© 2009 IBM Corporation38
AtomService BINDFILE
CICS Utility DFHLS2SC – Generates an XML schema and an XSD binding file
from a language structure
– XSD bind file will describe the record layout of the CICS resource used as a feed
• Maps the contents of the TS queue or File record etc. onto the Atom protocol XML.
CICS Transaction Server V4.1
© 2009 IBM Corporation39
Systems Programmer Interface for Atom Feeds
CREATE ATOMSERVICE
DISCARD ATOMSERVICE
INQUIRE ATOMSERVICE
SET ATOMSERVICE
INQUIRE URIMAP
New CW2A Transaction ID– Alias transaction for Atom feeds
CICS Transaction Server V4.1
© 2009 IBM Corporation40
Summary and Lessons Learned
We’ve seen:
– What is Web 2.0 and What is a RESTful SOA?
– Extending the Reach of SOA with IBM Products and a RESTful SOA
• WebSphere App Server, WebSphere sMash, WebSphere MQ, WebSphere Commerce, DataPower,…
– How CICS is enabling your existing enterprise data and applications to participate in this TODAY!
Principles for a RESTful SOA
– Unleash everything
– Design with REST in mind first
– Complements Enterprise SOA
– Take advantage of your business communities
CICS Transaction Server V4.1
© 2009 IBM Corporation41
References ATOM
– http://rollerweblogger.org/downloads/presentations/TriXML2006-BeyondBlogging.pdf
REST
– http://doc.opengarden.org/REST/REST_for_the_Rest_of_Us
CICS Supportpac CA8K
– http://www.ibm.com/support/docview.wss?fdoc=aimcics&rs=1083&uid=swg24018619
Tagging
– http://infotangle.blogsome.com/2005/12/07/the-hive-mind-folksonomies-and-user-based-tagging/
ProjectZero
– http://www.projectzero.org
Google's Gdata
– http://code.google.com/apis/gdata/index.html
Lotus Connections and Atom
– http://www.ibm.com/developerworks/lotus/library/connections-deploy-pt6/
CICS Transaction Server V4.1
© 2009 IBM Corporation42
CICS news delivered to your Inbox
• Find out what’s on the mind of other CICS users, industry analysts and CICS decision makers
• Learn about the latest CICS innovations and releases
• Get information about up to date CICS training opportunities and events
• Grab the CICS papers hot off the press
• Feedback directly to CICS people
… for all these and more, join the growing list of people who subscribe to
ibm.com/cics/enews
top related