consuming web services using ca 2e and ibm tooling

32
Consuming Web Services using CA 2E and IBM Tooling Raghunath Daita Senior Software Engineer

Upload: lamkhue

Post on 16-Dec-2016

223 views

Category:

Documents


2 download

TRANSCRIPT

Consuming Web Services using CA 2E and IBM Tooling

Raghunath Daita

Senior Software Engineer

2 Copyright © 2013 CA. All rights reserved.

Raghunath Daita

CA Technologies, Senior Software Engineer

“Web Services” is the buzzword in the IT industry these days. Since

release r8.5, CA 2E has the ability to expose the 2E business logic as a

Web Service. However, it does not, yet, have the ability to “consume”

external Web Services. This session will attempt to show a way forward

to “consume” Web Services from within CA 2E, using the potent

combination of CA 2E and IBM Tooling, thereby opening up a whole

new way of interaction between the CA 2E applications and the outside

world.

Abstract

Web Services and CA 2E’s Web Services Support

Introduction to IBM Tooling - Web Services Client for ILE

Introduction to IBM’s wsdl2ws.sh and wsdl2rpg.sh Tools

Consuming Web Services from CA 2E

Limitations

Demo

Q&A

Agenda

This presentation was based on current information and resource allocations as of April 2013 and is subject to change or

withdrawal by CA at any time without notice. Notwithstanding anything in this presentation to the contrary, this presentation

shall not serve to (i) affect the rights and/or obligations of CA or its licensees under any existing or future written license

agreement or services agreement relating to any CA software product; or (ii) amend any product documentation or

specifications for any CA software product. The development, release and timing of any features or functionality described

in this presentation remain at CA’s sole discretion. Notwithstanding anything in this presentation to the contrary, upon the

general availability of any future CA product release referenced in this presentation, CA will make such release available (i )

for sale to new licensees of such product; and (ii) to existing licensees of such product on a when and if -available basis as part of

CA maintenance and support, and in the form of a regularly scheduled major product release. Such releases may be made

available to current licensees of such product who are current subscribers to CA maintenance and support on a when and

if-available basis. In the event of a conflict between the terms of this paragraph and any other information contained in this

presentation, the terms of this paragraph shall govern.

Certain information in this presentation may outline CA’s general product direction. All information in this presentation is for

your informational purposes only and may not be incorporated into any contract. CA assumes no responsibility for the accuracy

or completeness of the information. To the extent permitted by applicable law, CA provides this presentation “as is” without

warranty of any kind, including without limitation, any implied warranties or merchantability, fitness for a particular purpose, or

non-infringement. In no event will CA be liable for any loss or damage, direct or indirect, from the use of this document,

including, without limitation, lost profits, lost investment, business interruption, goodwill, or lost data, even if CA is expressly

advised in advance of the possibility of such damages. CA confidential and proprietary. No unauthorized copying or distributi on

permitted.

FOR INFORMATION PURPOSES ONLY

Terms of this presentation

Web Services

Web Services

* Image obtained from IBM’s “Web Services Client for ILE Programming Guide”

The Beginning – CA 2E r 8.5

The Strengthening - CA 2E r8.6 – Extending Web Services support

through EAS

The Missing Link ? – Consuming External Web Services in CA 2E

CA 2E Web Services Support

Proven Business Logic

Web Service Consumer

Proven Business Logic

Web Service ConsumerEAS EAS

Web Services Client for ILE

– Based on Apache Extensible Interaction System (Axis) version 1.5.

– Axis is a framework for constructing SOAP processors such as clients and

servers.

– Supports version WSDL 1.1

– Helps create client stubs (C/C++/RPG) from the WSDL file which can

subsequently used to invoke Web Services

Stub Creation – Process Flow

Introduction to IBM Tooling - Web Services Client for ILE –IBM’s Web Services consumption solution

Process flow between WSDL source file

and stubs

Client Server interaction –

Process Flow

Introduction to Web Services Client for ILE –IBM’s Web Services consumption solution

Process flow between client and server

applications using stubs

“wsdl2ws.sh” and “wsdl2rpg.sh”

Run from Qshell.

Present in the <install_dir>/bin directory (typically

“/QIBM/PRODDATA/OS/WEBSERVICES/V1/CLIENT/bin/”)

“wsdl2ws.sh”

– Generates C stubs and creates a SRVPGM which binds these stubs

“wsdl2rpg.sh”

– Generates RPG stubs on top of C stubs and creates a SRVPGM which

binds these stubs

– Makes it easier to consume a Web Service from an ILE RPG program

Introduction to WSDL2WS.sh and WSDL2RPG.sh

Important arguments for “wsdl2rpg.sh” in context of

consumption from CA 2E

o WSDL-URI

o -o<directory-for-stub-sources>

o -s<qualified-SRVPGM-name>

o -t<timeout-value>

o -ms<maximum-string-size>

o -ma<maximum-array-size>

For further information on additional arguments, refer to

Chapter – 6 “Command Line Tools” in the below IBM Manual,

o http://www-03.ibm.com/systems/resources/systems_i_software_iws_pdf_WebServicesClient_new.pdf

WSDL2RPG.sh arguments

Disclaimer: - Consuming Web Services is not a current feature

of CA 2E. During the course of this presentation, we are only

attempting to demonstrate how CA 2E can be used to

consume external web services.

Consuming Web Services from CA 2E

Created a new command, CRTSTBSRV as a wrapper over

“wsdl2rpg.sh” to enable easier execution

Consuming Web Services from CA 2EChallenge – 1 - Creation of RPG stub code and a SRVPGM which exposes these stubs

What does the command do?

– Takes the desired Service Program name (STBSRVPGM) and creates an

output IFS directory, /home/USRPRF/myWSDLStubs/STBSRVPGM

– Builds the “wsdl2rpg.sh” execution string based on the parameter values

on command

– Executes the “wsdl2rpg.sh” string and generates the following

The C and subsequent RPG stub code in the output IFS directory

The modules and a service program in *GENLIB. This service program binds

the C and RPG stubs together and enables us to interact with the external Web

Service.

Note:- On V6R1M0 and above, the generated RPG stub code has the keywords len()

and varying() on the D-specs. Due to this, ensure that the correct TGTRLS value is set

on the CRT* commands prior to executing the CRTSTBSRV command, on V6R1M0 and

above.

Consuming Web Services from CA 2EChallenge – 1 - Creation of RPG stub code and a SRVPGM which exposes these stubs –Contd…

Contents in the output IFS directory– <portType>.c – contains the Client Stub implementation for remote WS

– <portType>.h – contains the header file for the C stubs

– <portType>.cl – contains the CRT* commands to create modules and the service program

– <portType>.rpgleinc – contains the RPG Client Stub procedure prototypes

– <portType>.rpgle – contains the RPG Client Stub procedure implementation

– <portType>_util.rpgleinc – contains the procedure prototypes of the utility procedures

used by the RPG Client Stub implementation code.

– <portType>_util.rpgle – contains the procedure implementation of the utility procedures

used by the RPG Client Stub implementation code

– <portType>_xsdtypes.rpgleinc – contains the RPG implementation of the XSD types used by

the WSDL

– In addition to these, if the WSDL contains any complex types, then we have two members

for each RPG implementation of the complex type which contain functions to work with

the RPG implementations. They are as follows

<RPG Implementation of complextype>.c

<RPG Implementation of complextype>.h

Consuming Web Services from CA 2EChallenge – 2 – High level understanding of Generated Stub contents

Of all the generated stub sources, there are three important

sources that are important for Web Service consumption.– <portType>.rpgleinc – contains the RPG Client Stub procedure prototypes

– <portType>_util.rpgleinc – contains the procedure prototypes of the utility procedures

used by the RPG Client Stub implementation code.

– <portType>_xsdtypes.rpgleinc – contains the RPG implementation of the XSD types used by

the WSDL

Important procedures to make note of– “stub_create_<portType>” – Used to obtain an instance of the Web Service. Returns a

handle that needs to be used for calling the Web Service operations.

– “stub_destroy_<portType>” – Used to destroy the instance of the Web Service. Uses the

handle obtained previously to destroy.

– ”stup_op_<operationName>” - Used to invoke the Web Service by passing in the handle,

input and output parameters.

Consuming Web Services from CA 2EChallenge – 2 – High level understanding of Generated Stub contents – Contd…

Interface of “stub_create_<portType>” procedureD stub_create_<portType>... D PR 1N extproc('stub_create_<portType>_') D this likeds(This_t)

Interface of “stub_destroy_<portType>” procedureD stub_destroy_<portType>... D PR 1N extproc('stub_destroy_<portType>_')

D this likeds(This_t)

The This_t structure used above represents a stub instance. It is defined in the <portType>_xsdtypes.rpgleinc file. It has the following structureD This_t DS qualified based(Template)D endpoint 2048aD handle *

D excOccurred 1nD excCode 10i 0D excString 2048aD reserved 1024a

Interface of “stub_op_<operationName>” procedureD stub_op_<operationName>…D PR 1N extproc('stub_op_<operationName>_') D this likeds(This_t) D Value0 likeds(<input parameter structure>)D Value1 likeds(<output parameter structure>)

Consuming Web Services from CA 2EChallenge – 2 – High level understanding of Generated Stub contents – Contd…

Consuming Web Services from CA 2EChallenge – 3 – Putting it all together in RPG to consume the Web Service.

Include necessary copybooks

Invoke stub_create_<portType> and obtain WS Endpoint.

Usng the WS Endpoint, Invoke stub_op_<operationName> and obtain the

result from Web Service.

Invoke stub_destroy_<portType> and

destroy WS instance.

Include processing to work with the output from stub_op_<operationName>

For the purpose of modelling the Web Service consumption within CA 2E, EXCUSRSRC function type has been used to wrapper the various stub procedures.

The IBM Tooling only returns the Web Service result. It is upto us to process the returned result.

Consuming Web Services from CA 2EChallenge – 4 – Modelling the Web Service consumption within CA 2E

An overview of functions used for this, is as follows

Consuming Web Services from CA 2EChallenge – 4 – Modelling the Web Service consumption within CA 2E

1_Include_Rpgle_Cpybooks

Consuming Web Services from CA 2EChallenge – 4 – Modelling the Web Service consumption within CA 2E – Contd…

2_Local_Fields_Defn

Consuming Web Services from CA 2EChallenge – 4 – Modelling the Web Service consumption within CA 2E – Contd…

3_stub_create_Wrapper

Consuming Web Services from CA 2EChallenge – 4 – Modelling the Web Service consumption within CA 2E – Contd…

4_stub_op_WS_Wrapper

Consuming Web Services from CA 2EChallenge – 4 – Modelling the Web Service consumption within CA 2E – Contd…

5_stub_destroy_Wrapper

Consuming Web Services from CA 2EChallenge – 4 – Modelling the Web Service consumption within CA 2E – Contd…

6_stub_error_msg_Wrapper

Consuming Web Services from CA 2EChallenge – 4 – Modelling the Web Service consumption within CA 2E – Contd…

7_Invocation_PGM_EUS

Consuming Web Services from CA 2EChallenge – 4 – Modelling the Web Service consumption within CA 2E – Contd…

8_Invocation_MOD_PGM – Bringing all the EXCUSRSRC functions together and build the Web Service consumer

Consuming Web Services from CA 2EChallenge – 4 – Modelling the Web Service consumption within CA 2E – Contd…

8_Invocation_MOD_PGM – Contd…

Consuming Web Services from CA 2EChallenge – 4 – Modelling the Web Service consumption within CA 2E – Contd…

Dates sent and received must be after midnight 1st January 1970.

Attachments are not supported. WSDL's used for wsdl2ws.sh/wsdl2ws.rpg must be encoded

using UTF-8. Web service responses must be in UTF-8 format Complex WSDL types which reference each are not generated

correctly.

Limitations

Demo

Q&A

Thank You

Note:- Please fill out the evaluation forms at the end of the

session.