Web Services An Introduction

insidiousbehaviorΑσφάλεια

3 Νοε 2013 (πριν από 3 χρόνια και 9 μήνες)

192 εμφανίσεις

®


IBM Software Group

© 2009 IBM Corporation

Web Services


An Introduction

Leigh Compton


Certified IT Specialist


CICS, Web Services and Java

David Myers


RDz PLM

2

IBM Trademarks and Copyrights


© Copyright IBM Corporation 2007, 2008, 2009, 2010. All rights reserved.



The information contained in these materials is provided for informational purposes
only, and is provided AS IS without warranty of any kind, express or implied. IBM
shall not be responsible for any damages arising out of the use of, or otherwise
related to, these materials. Nothing contained in these materials is intended to, nor
shall have the effect of, creating any warranties or representations from IBM or its
suppliers or licensors, or altering the terms and conditions of the applicable license
agreement governing the use of IBM software. References in these materials to IBM
products, programs, or services do not imply that they will be available in all countries
in which IBM operates.



This information is based on current IBM product plans and strategy, which are
subject to change by IBM without notice. Product release dates and/or capabilities
referenced in these materials may change at any time at IBM’s sole discretion based
on market opportunities or other factors, and are not intended to be a commitment to
future product or feature availability in any way.



IBM, the IBM logo, the on
-
demand business logo, Rational, the Rational logo, and
other IBM Rational products and services are trademarks or registered trademarks of
the International Business Machines Corporation, in the United States, other
countries or both. Other company, product, or service names may be trademarks or
service marks of others.

3

Services are the driving business system design paradigm of the day.


Services


Generated by RDz provide a cross platform language for business oriented development


Services and SOA are based on the concept of “Service Oriented Design”

External

Web

Service

W

S

D

L

RDz

Records

RDz

Service

RDz

Service

WSDL

RDz

Interface

RDz SOA for WAS, CICS, System i

At development time…


Focus on the business logic


Implement SOA design elements: services and interfaces


Leverage existing business developers for new SOA
development


Ignore deployment targets/technology while coding/testing

Deploy Web Services…

To any platform


Java to WAS/Tomcat/etc.


COBOL to CICS, iSeries

As…


A Web Service (uses SOAP)


A private service (uses CICS ECI, J2C, or TCP)


Other SOA runtimes when they reach critical mass

Leverage external web services…


Service Interfaces



Represent external web services



Are created via import from WSDL



Allow the RDz developer to stay within the
context of the RDz programming model

External Applications

Deploy Services as Web Services

Consume external services

The Promise of Services and SOA (Service Oriented Architecture)

© 2008 IBM Corporation

4

At a Very High Level

What we’re ultimately getting at here is a decoupling of application requester
from the application provider. And the placement of an intermediary function
to make things more flexible and dynamic:

Intermediary Function

Simple forwarding

or

Complex message
transformation and
protocol remapping

Passing of an agreed
-
to request in
message format

Return of information in the
form of an agreed
-
to
message response

© 2008 IBM Corporation

5

What’s Behind This … Why Are We Talking About This

Over the years our application systems have become very complicated, with
tightly
-
coupled relationships that are often little understood.



Actual application architecture
map from real
-
life customer

Changes to any part of
this are …


Difficult to determine what
impact there is on other
components


Expensive to analyze, often
expensive to implement


Delays often result in missed
opportunities

Two objectives: eliminate tight (hard
-
coded) interconnections, and create a
way for one program to dynamically seek, find, and bind to another.

Two
basic

problems:

1.
Inflexible connectivity definitions
(hard
-
coded, deeply imbedded in
code)

2.
Knowledge of relationships lost
over time

Possible third: duplication of
resources because reuse
difficult in this environment

© 2008 IBM Corporation

6

A “Service”


Conceptual Definition

A
discrete

set of business or technical functionality that can be
identified
, has
a
defined

set of input and outputs, and is
reusable



User

“Consumer”

Service

“Producer”

Input

Output

Discrete



can be contained within a definite and known “fence”

Identified

--

it’s recognized as a service and people acknowledge it as a service

Defined



the input and the outputs are known and understood

Reusable



is not just a one
-
time thing

There’s nothing revolutionary about this. What’s different is that we’re coming to a point
where improvements in technology have allowed us to do this better than before:


Settled on a universal and common networking protocol
--

TCP/IP


Networking bandwidth is increasingly available, cheap and reliable


The idea of “industry standards” has matured and is embraced rather than resisted


Java as a platform
-
unaware language has opened up a new world of interoperability


Interface

Implementation

Exactly how the service
is implemented behind
the interface doesn’t
really matter to the
consumer of the service

© 2008 IBM Corporation

7

An Example
-

Currency Exchange

IBM’s Travel Expense Reimbursement application does not do its own foreign
currency conversions … it uses an external service for that:



Currency = $US?

Interface

Implementation

$US

No

Yes

Internet


[ £100,$US,15
-
June ]


[ $196.00 ]

For this to work, several things need to be in place:


IBM application needs to know about the service and where it is located


IBM application needs to know the interface requirements: parameters, sequence, format

Could IBM have coded an internal subroutine to do currency conversions? Sure. But very good
converters exist on the web and in this case IBM took advantage of them.

Understanding what services are available, where they’re located and what
interface requirements they have is a key aspect of SOA.

© 2008 IBM Corporation

8

Another Example
-

CICS Web Service

We’ve not really defined what a “web service” is … but for now be aware that
CICS has the ability to front
-
end existing CICS programs with a web service
interface … “exposing” the CICS program as a service:

CICS Web
Service
Front
-
End

Existing
CICS
Program

CICS V3.1

Network

Web Service
Client
Program

CICS program
unchanged

Appl

3270

EXCI

Traditional
access
unaffected

New front
-
end
allows service
oriented
invocation

SOAP/HTTP

Key point is that a traditional CICS program can be turned into a message based
“service” which can then be used by “service consumers” in your network

Interface

© 2008 IBM Corporation

9

Service Oriented Architecture

Service oriented architecture
(SOA) is a business
-
driven IT
architectural approach that
supports integrating the
business as linked, repeatable
business tasks, or services.

From
www.ibm.com


An exact definition is probably not all that important. It's more
important to understand:


The concept of a “service”


The implied value of a loosely coupled “service” rather than a tightly coupled connection to
another application’s interface … flexibility


That “SOA” is a
path

towards the use of more and more services in your I/T architecture …
not a “thing” or an “all
-
at
-
once” proposition


That there’s more to it than
just

services.

© 2008 IBM Corporation

10

CICS is an Application
Server

CICS is a system that hosts applications, and provides a rich set of “services”
which the applications may make use of:

CICS Services

External Data
Resources

“EXEC CICS” API

C++ classes for CICS

JCICS classes for Java

“CICS Programs”

COBOL

C/C++

PL/I

Assembler

Java

EJBs

CICS EJB Support

(transparent mapping)

CICS

Program

Access

JVMs

There are many ways to access programs running in CICS
--

3270 terminal,
EXCI or EPI, RMI/IIOP, MQ, HTTP. Our focus here is going to be accessing via
Web Services.

These are the
“existing assets”
we’re looking to
“expose” as
services

© 2008 IBM Corporation

11

Provider vs. Requester
--

CICS Can Do Both

CICS as a Web Service Provider …

We typically consider CICS as a
provider

of web services:

Web
Service
Client

Appl

CICS

But it can also be a consumer (or requester) of web services:

Appl

CICS

Web
Service
Client

This web service could be
anywhere accessible to CICS
--

inside your company or outside

We’ll focus on the top one for the most part. The concepts you’ll see are mostly
applicable to both environments. See “CICS Web Services Guide” (SC34
-
6458) for more.

The case where existing (or new)
CICS applications are exposed as
reusable services.

External
Service

© 2008 IBM Corporation

12

CICS as a Web Services Provider

Three basic requirements of being a Web Services provider:

Ability to receive the SOAP request

Standard ways: SOAP/HTTP or SOAP/JMS

Ability to read and understand the contents of the SOAP request

XML parser along with implementation of the “WS
-
basic” standards

Ability to act upon the request

This is the “behind the interface” implementation we’ve shown before

HTTP

MQ

Built
-
in SOAP
Handler

Custom
Program

CICS
Transaction

CICS

This is defined within something called a “Pipeline,” which is a structure
within CICS that invokes your customized program(s).

This is what does the mapping of XML to application data structure and
invokes the CICS transaction.

© 2008 IBM Corporation

13

CICS Web Services Development Tools

There are two primary tools used to develop CICS web services:

1. CICS Web Service Assistant

Consists of a set of JCL batch utilities that generate program components


DFHLS2WS



Transforms a language structure into a Web Service Binding File and a Web Service
Description (WSDL). Use this to put a web service front end on an existing application.


DFHWS2LS

-

Generates a Web Service binding file from a Web Service description (WSDL). This utility also
generates a language structure that you can use in your application programs. Use this to create a new
CICS application based on a WSDL, or to enable CICS to be a web service requester

2. Rational Developer for System z (RDz)

An Eclipse
-
based tool for zSeries development (not
just

web services), it does what CICS Web
Service Assistant does with additional flexibility and capabilities.

RDz is the more powerful alternative.


CICS Web Service Assistant should only be used for basic
web services enablement and when Eclipse expertise is
lacking

© 2008 IBM Corporation

14

What’s Produced by RDz for Web Services

The process of creating and defining a Web Service to CICS

z/OS
System

COBOL source, including
COPYBOOK of existing
CICS application

COBOL source to our new
handler, which converts SOAP
XML
-
to
-
COMMAREA and vice
-
versa

WSBIND

file, which is a binary file
that contains information about the
service, including the “
URI Map
” that
triggers the execution of the pipeline
and web service

RDz

Import
into RDz

Run through
the creation
wizards

Compile this into
the CICS LOADLIB

Optional used to
define the CICS
pipeline entries

More complex scenarios can
occur, of course. But this
illustrates some essential
elements of the process

15

The Importance of XML in Web Services

You will see that XML is the common mechanism to exchange information in a
web services environment.
What is XML, and why is it valuable?

<SOAP
-
ENV:Envelope>


<SOAP
-
ENV:Body>


<q0:DFHCOMMAREA>


<CustNo>3</CustNo>



</q0:DFHCOMMAREA>



</SOAP
-
ENV:Body>

</SOAP
-
ENV:Envelope>

A series of “tags” that mark the beginning and end of
blocks of XML

It holds both the data, as well as description of the data

<CustNo>

provides an indicator of what the data is; “3” is the actual data.

It is both machine readable and human readable, which
makes things relatively easy to understand

Contrast with bit
-
format protocols, where bits within bytes meant certain
things. Machine readable yes; human readable less so.

Characters use “Unicode” encoding, which means it’s
universally understood

As opposed to the old EBCDIC vs. ASCII debates


Example of XML SOAP envelope
we’ll use in one of the labs

XML can be “parsed”

XML is “Self Describing”

Something called a “Schema Definition” (XSD) is
used to tell a program what XML tags to expect.

The WSDL file (more in moment) has XSD
information

If a program knows what tags to
expect (the WSDL supplies this),
then the program can “parse”
(extract) information from the XML.

16

“SOAP over HTTP”

The Web Service Description Language (WSDL) file …

<SOAP
-
ENV:Envelope xmlns:SOAP
-
ENV="http://schemas.xmlsoap.org/soap/envelope/"


xmlns:q0="http://www.WBCSCUSTI.com/schemas/WBCSCUSTIInterface"


xmlns:xsd="http://www.w3.org/2001/XMLSchema"


xmlns:xsi="http://www.w3.org/2001/XMLSchema
-
instance">


<SOAP
-
ENV:Body>


<q0:DFHCOMMAREA>


<CustNo>3</CustNo>



</q0:DFHCOMMAREA>



</SOAP
-
ENV:Body>

</SOAP
-
ENV:Envelope>

You’ll frequently hear this phrase. What it’s referring to is the passing of an
XML document
--

a SOAP “envelope”
--

using the HTTP protocol

Web Service
Client

Web Service
Provider

HTTP Protocol

(TCP/IP Network)

XML File

The key is that the client program knew what the provider expected
--

what data
elements and what XML tags to use. How did it know that? It had the WSDL file.

The SOAP input for our CICS lab

Knowing the layout is not that important to
us at this point

17

The WSDL File

Where does WSDL come from? …

WSDL contains information about the service
--

where it’s located, what
parameters it takes as input, what it gives back as output, what XML tags to
use, etc. It is sometimes known as a “bindings file”.

It can be long and complicated … what follows is a boiled
-
down snippet to show essence

<SOAP
-
ENV:Body>


<q0:DFHCOMMAREA>


<CustNo>3</CustNo>



</q0:DFHCOMMAREA>

</SOAP
-
ENV:Body>

Web Service
Client

<complexType name="DFHCOMMAREA">


<sequence>


<element name="CustNo">


<simpleType>


<restriction base="int"/>


</simpleType>


</element>


</sequence>

</complexType>



<wsdl:service name="WBCSCUSService">


<wsdl:port binding="tns:WBCSCUSBinding" name="WBCSCUSPort">


<soap:address location="http://mig.null.washington.ibm.com:12301/WBCSCUST"/>


</wsdl:port>

</wsdl:service>


What service will return was here … removed to save space

Web Service
Provider

Client knows input XML and
data requirements based on this

Client knows where service
is located based on this

18

WSDL File is a Product of RDz

You
could

hand
-
code the WSDL.

More likely you’ll use a development tool (in our case, RDz)
to create the web service, and RDz will also produce the
WSDL.

Web Service
Client

Web Service
Provider

Service Program

WSDL File


Rational Application Developer


WebSphere Developer for zSeries


Other Development Tools

With WSDL, client
knows where service
is and how to drive it

19

That's all well and good, but what about performance?

http://listserv.uga.edu/cgi
-
bin/wa?A2=ind0908&L=CICS
-
L&D=0&P=30338


That’s .1 second

1/10th of a second

Any other questions about "Why Web Services"?

20

Legacy

Data Abstraction

Data Services/Messaging

Services

Process/Orchestration

Monitoring/Event Management

Security

Governance

Rep

Data

SQL/

XQuery/XML

J2EE/JCA (EJB)

Source: Linthicum Group

IMS

App

IMS

App

IMS

App

J2EE/JCA

(EJB)

SOAP/J2EE

IMS Database
Web Services

IMS

DB

Service Oriented Architecture Model


and IMS

21

IMS On Demand Overview

Web Service

.NET
Client

Client
Developer

Application
developer

SAP
Client

Web
service
clients

Java/J2EE
Client

Java
dev

Direct
Database
access
Developers

Java /J2EE
Developer

CICS
Developer

DB2
Developer

Java

class

Library

Direct


SOAP


IMS SOAP

Gateway

WDz

Solutions

WID

RAD

IMS TM

Resource

Adapter

MFS Web

Services

WebSphere

Solutions

DLI

Model

Utility

DLI

Model

Utility

DB2
SP/CICS

Java

class

Library

Java

class

Library

WebSphere

IMS DB

Resource

Adapter

IMS


Database

IMS Connect

ODBA /DRA

SQL

XQuery

DL/I

DL/I

SOAP

TCP

/IP

Java

class

Library

Transaction
manager

IMS
APP

Database
manager

DLI

Model

Utility

22

App

IMS

TM

CONNECT

IMS

DB CTRL

z/OS

TCP/IP Access to IMS

23

Architecture Foundation
-

IMS Connect



A capability that provides connectivity support between TCP/IP
applications and IMS transactions


Integrated into IMS V9


Configured on a z/OS server


Benefits and Value



Supports TCP/IP sockets access to IMS transactions and commands


Provides a general purpose and structured interface


Provides a strategic base for new connection technologies:


Operations Manager


IMS Control Center


IMS SOAP Gateway


MFS Web Services

IMSA

IMS Connect

IMSB

VTAM

TCP/IP

Java Applet

BROWSER

Web

Server

COMTI

Visual Basic

PowerBuilder

...

Web Server program

Websphere

Cobol

Assembler

C/C++

Java

24

App

IMS

TM

CONNECT

IMS

DB CTRL

z/OS

App

TM RA

WebSphere

IMS TM Resource Adapter

25

J2EE/JCA Architecture

Application

Component

Security


Management

Transaction


Management

Connection


Management

J2EE Application Server

EIS

Application Contract

EIS
-
specific interface

System

Contracts

Container
-
Component

Contract

SPI (service provider


interface)

CCI (common client


Interface)

Resource

Adapter

26

PLI

IMS TM Resource Adapter …


Supports the development of J2EE applications, Web services, and
business processes that can interface with IMS Connect


Development component


Rational Developer for System z


RDz


Runtime component



Must be installed into an application server, e.g., WebSphere


WebSphere

Unit Test

Environment

IMS

RESOURCE

ADAPTER

IMS

SERVICE

DEPLOY

& TEST

IMPORT

C

COBOL

RDz

IMS

RESOURCE

ADAPTER

imsico.RAR

Appl.EAR

J2C

Connection

Factory

IMS

IMS

Connect

Installed

Applications

TCP/IP

WebSphere Application Server

Export

(supplied with

IMS Connect)

Toolkits that generate web services, EJBs, JSP, etc. for IMS, CICS, DB2

Java
Applet

BROWS
ER

27

27

© Copyright IBM Corporation 2010. All rights reserved.
The information contained in these materials is provided for informational purposes only, and is provided AS IS without warra
nty

of any kind,
express or implied. IBM shall not be responsible for any damages arising out of the use of, or otherwise related to, these m
ate
rials. Nothing contained in these materials is intended to, nor shall have
the effect of, creating any warranties or representations from IBM or its suppliers or licensors, or altering the terms and c
ond
itions of the applicable license agreement governing the use of IBM
software. References in these materials to IBM products, programs, or services do not imply that they will be available in al
l c
ountries in which IBM operates. Product release dates and/or capabilities
referenced in these materials may change at any time at IBM’s sole discretion based on market opportunities or other factors,

an
d are not intended to be a commitment to future product or feature
availability in any way. IBM, the IBM logo, Rational, the Rational logo, Telelogic, the Telelogic logo, and other IBM produc
ts
and services are trademarks of the International Business Machines
Corporation, in the United States, other countries or both. Other company, product, or service names may be trademarks or ser
vic
e marks of others.

Learn more at:


IBM Rational software


Rational launch announcements


Rational Software Delivery Platform


Accelerate change & delivery


Deliver enduring quality


Enable enterprise modernization


Rational
t
rial downloads


developerWorks Rational


Leading Innovation


IBM Rational TV


IBM Business Partners


IBM Rational Case Studies


Ensure Web security & compliance


Improve project success


Manage architecture


Manage evolving requirements


Small & midsized business


Targeted solutions