× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



You beat me too it Niels - I was going to put the XML face on it! :-) I
just ran a test of the web service and am going to make some changes that
will (hopefully) provide a less verbose approach to XML'ing the
VirtualTerminal API's. I have a couple other project things to get out of
the way before I do this though, including working on some RPGMail stuff
for somebody else I promised about a month ago (sorry if you are
listening).

You are just a mad man coder! My mind is just brimming with possibilities
for this as you have accomplished in about 1 week what I was thinking
would take me more than a month.

Aaron Bartell
http://mowyourlawn.com

Niels Liisberg wrote:

Nathan wrote


This has a lot of potential to bridge the gap between new Web interfaces,


and existing 5250 interfaces, or even new 5250 applications that folks may
have in mind, by deploying them all together under a Web portal.<<

Hi gents;

Actually it came to me after reading Nathan's fruity post: The biggest
potential might be the decoupling possibilities of 5250 applications to SOAP
services. I never thought that I would endorse a solution like this, but I
have changed my mind for a couple of reasons:

First - The type of 5250 applications you would like to plug into a SOA
architecture might be so "legacy" it is not worth or to complicated to
rewrite.

Second - A screen scraped web-service might buy you time when you are in a
transition phase between old and new.

Last - If you use the "IceCap" approach, your scripting language is good old
RPG and you can mix screen scraped logic with new logic. When the
implementation runs, you can decide whether or not to rewrite or just leave
it as is.

IMHO other screen scraper approaches fails because you need to run the
scraper scripts in languages you might not know or even on a different
platform or at least in a different environment.

IceCap runs as a native RPG application in a web session on top of one or
more 5250 sessions.

For that reason I have extended the "IceCap" Virtual Terminal Service with
some really handy functions.

Look at this following sample which is a complete SOAP web-service returning
the current CPU utilization.

This is simply done by the contents of the "WRKSYSSTS" panel.

Here is the source or the RPG "script"...:


---------------------------------------------------------------------------
<%@ language="RPGLE" pgmtype="webservice" pgmopt="MODULE(iceCapWs SVC242)"
%>
h nomain

/include qasphdr,iceCap
d pVts s * inz(*null)
d vtSession ds likeds(vtsDS) based(pVts)

d vtField ds likeds(vtFieldDS)

//' ------------------------------------------------------------------------
//' getSysSts - Get System Status webservice method
//' ------------------------------------------------------------------------
p*name++++++++++..b...................keywords++++++++++++++++++++++++++
p getSysSts B export

d getSysSts pi
d cpuUsed 5 2 output
d sysAspSize 7 2 Output
d sysAspUsed 9 4 Output

d panelFound s n
d decp s 1 inz(',')
//' ------------------------------------------------------------------------
/free

//' Open the virtual terminal session if not open yet.
if (pVts = *null);
pVts = vtOpen();
endif;

//' Locate the "Work with System Status" panel
PanelFound = *OFF;
dou (PanelFound);
select;
//' logon if the signon is displayed
when vtSaaTitleContains(pVts:'Sign On');
vtSetFieldNo(pVts: 1 : 'DEMO'); // First field is the userprofile
vtSetFieldNo(pVts: 2 : 'DEMO'); // Second field is the password
vtSetFieldNo(pVts: 3 : 'QCMD'); // Program to run - QCMD
vtPressKey(pVts: vtENTER);

//' run wrksyssts if command entry is displayed
when vtSaaTitleContains(pVts:'Command Entry');
vtSetFieldNo(pVts: 1 : 'wrksyssts');
vtPressKey(pVts: vtENTER);

//' Refresh statistics in the system status is displayed
when vtSaaTitleContains(pVts:'Work with System Status');
vtPressKey(pVts: vtF10);
PanelFound = *ON;

other;
// !! TODO - invalid screen
return;
endsl;
enddo;

//' Got the panel - peek the return fields for the webservice
cpuUsed = num(vtGetScreen(pVts: 3: 29 : 10 ): decp);
sysAspSize = num(vtGetScreen(pVts: 4: 70 : 8 ): decp);
sysAspUsed = num(vtGetScreen(pVts: 5: 70 : 10 ): decp);
return;

/end-free
p getSysSts e
%>
---------------------------------------------------------------------------

One thing I am especially proud of in IceBreak is the implementation of
WebServices. It is all done in RPG and based upon the RPG source with a
little use of annotations.

Basically it is one (ore more) procedure(s) in a services program that acts
as method(s) in the webservice.

The name of the "method" in this case is "getSysSts" and it is returning
three properties. You can see the annotation added to the RPG syntax -
namely "output"


d getSysSts pi
d cpuUsed 5 2 output
d sysAspSize 7 2 Output
d sysAspUsed 9 4 Output



When the web-service is invoked it will start a new session on the virtual
terminal with the "vtOpen" and navigate to the "WRKSYSSTS" panel.

This is done by a new "IceCap Buildin" used like this:

When vtSaaTitleContains(pVts:'Sign On');

The vtSaaTitleContains procedure returns true if it locates the value string
- in this case "Sign On". The panel must SAA compliant for it to work ( All
IBM panels (except a handful) are SAA. SAA states that the title will be
centered and high lighted/white.

When the "WRKSYSSTS" panel is found I use a combination of Num() and
vtGetScreen() to pull data out of the screen.

The Num() procedure is a IceBreak build in which converts a string to number
disregarding invalid numeric chars.

vtGetScreen() on the other hand is the "grabber" interface. The following
returns the CPU % from a Virtual Terminal Session at line 3 column 29 and
the following 10 chars - decimal point can be "." for US or "," for Europe:

cpuUsed = num(vtGetScreen(pVts: 3: 29 : 10 ): decp);


When you refer to this IceCapWS.asmx file from a browser, it will compile
the webservice (if needed) and produce the WSDL that goes along.


http://icebreak.org:60000/IceCapWS.asmx?wsdl



The code can be verified by the excel spread sheet "SystemStatus.xls", where
I have imported the web-service and use it from within this macro:

---------------------------------------------------------------------------
Sub Macro1()

Dim ws As New clsws_icecapws
Dim sysAspSize As Double
Dim sysAspUsed As Double
Dim cpuUsed As Double

'Call webserice and return cpu% etc.
cpuUsed = ws.wsm_getSysSts(sysAspSize, sysAspUsed)

'Update sheet
Row = ActiveCell.Row
Cells(Row, 1) = cpuUsed
Cells(Row, 2) = sysAspSize
Cells(Row, 3) = sysAspUsed

'Move to next row
ActiveSheet.Cells(Row + 1, 1).Select

End Sub
---------------------------------------------------------------------------

I have zipped all the files including the "programmers guide" where chapter
6.1 covers web-services.

Find it at:

http://demo.icebreak.org/webfiles/IceBreak/WebServices.zip

The zip file contains:

IceCap.rpgle.h The IceCap header file for Virtual Terminal
IceCapWS.asmx The RPG Webservice demo
IceCapWS.wsdl The output from the service if you run it with ?WSDL
Svc242.c The Virtual Terminal 5250 wrapper and Parser
services.
SystemStatus.xls A testing XLS spread sheet that calls the webservice





Best regards


Niels Liisberg
IceBreak Chief SW Architect

System & Metode Technologies
Haandvaerkersvinget 8, DK-2970 Ho/rsholm
Phone: +45 70 20 36 10
Fax: +45 70 20 30 11
Direct: +45 45 177 055
Mobile: +45 31 158 861
E-mail: nli@xxxxxxxxxxxxxxxxx
Web: www.system-method.com and www.Icebreak.org



As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.