Presentation for October 2011 "RPG – WSDL2RPG better than IBM`s

Download Report

Transcript Presentation for October 2011 "RPG – WSDL2RPG better than IBM`s

RPG – WSDL2RPG
better than IBM’s utility
Ed Waldschmidt
[email protected]
260-481-5361
September 30, 2011
Quick Poll
How many have worked with web
services?
How many have attempted
programming the interface for WSDL’s
and have been successful?
How many have done this in RPG?
WSDL programming made
simple.
• Tools 400 has an utility which generates both
the service program and the module
• The utility is called WSDL2RPG
• Command interface for I-Series developers
• Generated code does compile
• Best part, it is free. Free software for the ISeries
IBM and the tool
• IBM liked the tool, however, IBM dropped the
command interface.
• Developers need to know how to navigate QShell.
• With IBM’s version, need to have Websphere
installed on the system.
• V5R1 is the oldest release supported, however
V6R1 is recommended.
IBM and the tool cont.
• JAVA also needs to be installed on the ISeries
• Defaults to C#.
• One must manually setup the RPG source
file before migration. Library and source file
with member needs to be created first
• Good luck
WSDL2RPG tool
• Tools/400 shareware version resides in a
library on the I Series.
• Provides a command that can be prompted
for the native I-Series developer which makes
code generation easier.
• Tool evokes the WSDL for the developer
through HTTPAPPI to select correct module
of WSDL
WSDL2RPG tool (cont)
• Generated code will compile
• Can generate both the module and program
• Markers are created in the program to indicate what
to pass for the WSDL
• With minor changes the code (to add the parms the
WSDL needs) does run and return values
• The tool will poll the WSDL and show you the
different WSDL’s that are available
• Requires Scott Klements HTTP software
Wave of the future
• More and more companies and government entities
are setting up WSDL’s for people to tap into
information. Such as : UPS for rates and delivery
status
• This tool makes the code generation easy
• Good support from Tom Radditz on his code
• Try it. You will like it.
Downside to tool
• Code generated is not pretty and is very
complex. Most generated code is this way
• Module compile is very big and has every
procedure that could possibly be used. Most are
not needed
Sample code
Code tells you where to put your parameters for
call.
// Set the paramater values of the request message
// of the web service.
// assign values here
parameters.ZipCode = Pzipcode;
Substitute a value for the zipcode. Pzipcode was
added to the module as a parameter
Sample code cont.
• You wrapper program is just reading your data
and passing values to the module call.
• The module will return values if needed
including HTTP errors returned
• After control is passed back to your calling
program, the rest is native ILE that you
developed in RPG.
Real Example – Weather WSDL
•
•
// If the Web service finished successfully ...
• B01 if (not WeatherForecastSoap_isError());
•
// ... get response data from response
data structure
Real Example – Weather WSDL
cont.
• text = 'Retrieved ' +
•
(GetWeatherByZipCodeResponse...
•
.GetWeatherByZipCodeResult.Details)
•
+ ' zip codes for ' +
•
parameters.ZipCode ;
Real Example – Aplicor WSDL
cont.
X01
else;
// ... else show error messages ordered by
priority:
// 1. HTTP error information
text = %char(
WeatherForecastSoap_HttpError_getCode()
) + ': ' +
WeatherForecastSoap_HttpError_getText()
Real example – Weather
WSDL cont.
• The only modification is adding the parms to
program
• The other modification that would be needed
is to write the wrapper program so that it can
handle return information.
• Otherwise, native ILE code