XMLSERVICE Demo

Goto Main Page
Goto Documents

XMLSERVICE



There are many ways to run XMLSERVICE from 1-tier/2-tier applications, this page is intended to demonstrate some of the ways using this IBM i machine (YiPs IBM i machine you are on it right now). These demos are for educational purposes, so please be nice and no hacking and we can continue offer easy examples without major restrictions.

0) PHP help RPG

This demo shows PHP bringing RPG to web multiple ways.

PHPhelpRPG.html

←Click the image on the left to run the demo. Look for “Run me” to run examples.

{Download DVD_demo 1.0.1} — 5250/PHP/RPG DVD movie shop
{Download code viewer 1.0.1} — pretty code foil viewer

Notes:

  • Demonstrate using RPG and PHP together for a partial DVD shopping application. DVD application was written in RPG using DSPF with subfile (5250 application). PHP was added to help bring the application to the web. Multiple web requirements were easily addressed with available PHP technology.
    • PHP access to DVD order data base (ibm_db2)
    • PHP access to DVD RPG business logic (PHP Toolkit)
    • PHP web services for RPG business logic (REST and SOAP)
    • Just for fun, RPG calling PHP (PASEMAIN)

1) New PHP Toolkit

This demo shows PHP Toolkit using XMLSERVICE included with download of Zend Server 5.1.1.

Toolkit.html

←Click the image on the left to run the demo.

{Download Demo 1.6.8} — active samples use pooled private connections ($maxpool)


Notes:

  • Zend Manual - reference material for new PHP Toolkit
  • This demo uses Toolkit “close” to avoid any jobs left on your system ($obj→disconnect()), so demos run much slower than more common production reused XMLSERVICE job style connections.
  • Demo Toolkit PHP code is running on YiPs IBM i, but you can also use the same PHP code from Linux/Windows/etc. in 2-tier to IBM i.
  • The toolkit, compatibility layer and xmlservice are included default installation of Zend Server for IBM i.
  • Do-it-yourself updates can be downloaded from the main page of XMLSERVICE, or you can wait until Zend creates an update Zend PTF.
    • Note: If you are running 2-tier from your laptop your will need to download the update PHP source manually from XMLSERVICE main page.

2) XMLSERVICE PHP XML

This demo shows PHP XML interface using XMLSERVICE (also known as “raw XML” interface).

XML.html

←Click the image on the left to run the demo.

{Download Demo 1.6.8} — active samples use pooled private connections ($maxpool)


Notes:

  • This demo shows what happens below Zend PHP toolkit wrapper using “raw” XMLSERVICE interface (PHP + XML), which you are welcome to use with/without the new PHP toolkit.
  • This demonstrates using XMLSERVICE over various PHP DB2 interfaces ibm_db2. pdo_ibm, odbc, rest, etc.

3) XMLSERVICE HTML/XML Only

This demo shows XMLSERVICE running HTML/XML with no scripting language at all (no PHP).

index.html

←Click the image on the left to run the demo.

{Download Demo}


Notes

  • Do not be fooled by XSLT “style” colors you see in demo everything is just HTML/XML, use browser “page source” to see HTML/XML used input/output XMLSERVICE.
  • Bill of materials (click name to see source)
    • index.html - HTML XML scripts (multiple <sql></sql> not required to run DB2, but it made XSLT easier).
    • DemoXlst.xsl - XSLT (styles), colors of XML are in here
    • RPG tests called by demos (RPG crttest included with RPG xmlservice download main page)
  • You will need a user/password on your site …
    • XMLCGI must be compiled/run on a matching IBM i release for Apache CGI to work (distribution fixed 1.6.8+).
    • XMLCGI authority index.html *NONE requires a special compile of RPG source (crtxml3) and is NOT enabled in production versions of the toolkit by default. However, you can recreate this demo editing index.html using a valid user/password on your machine like form below:
<form name="input" action="http://MYIBMIMACHINE/cgi-bin/xmlcgi.pgm" method="post">
<input type="hidden" name="db2" value="*LOCAL">
<input type="text" name="uid" value="MYUSERID">
<input type="password" name="pwd" value="MYPASSWORD">
<input type="hidden" name="ipc" value="/tmp/MYUSERID0001">
<input type="hidden" name="ctl" value="*sbmjob">
<input type="hidden" name="xmlin" 
value="<?xml version='1.0'?>
<script>
<comment>your XML script here, cmd, sh, sql, pgm (below)</comment>
</script>">
<input type="hidden" name="xmlout" value="500000">
<input type="submit" value="MYBUTTON" />
</form>
  • IBM i instant customized laptop applications in about 3 minutes work …
    • You may find it interesting to note that if you cut/paste any of the HTML <form> from the index.html and put them on your PC laptop (example: iapp.html), you can use your PC browser as a custom 2 tier application to this machine. The only “trick” is to finish the full domain name to this machine in the action keyword on the <form action=> (see below).
action="/cgi-bin/xmlcgi.pgm"
-- becomes --
action="http://174.79.32.155/cgi-bin/xmlcgi.pgm"

--- cut/paste below ---
<!-- XMLSERVICE DB2 query (select/fetch) -->
<form name="input" action="http://174.79.32.155/cgi-bin/xmlcgi.pgm" method="post">
<input type="hidden" name="db2" value="*LOCAL">
<input type="hidden" name="uid" value="*NONE">
<input type="hidden" name="pwd" value="*NONE">
<input type="hidden" name="ipc" value="/tmp/rangerhtmlonly">
<input type="hidden" name="ctl" value="*sbmjob">
<input type="hidden" name="xmlin" 
value="<?xml version='1.0'?>
<?xml-stylesheet type='text/xsl' href='/Samples/Toolkit_HTML/DemoXslt.xsl'?>
<script>
<sql>
<options options='noauto' autocommit='off'/>
</sql>
<sql>
<connect conn='myconn' options='noauto'/>
</sql>
<sql>
<query conn='myconn'>select * from xmlservtst/animal</query>
</sql>
<sql>
<describe desc='col'/>
</sql>
<sql>
<fetch block='all' desc='on'/>
</sql>
<sql>
<free/>
</sql>
</script>">
<input type="hidden" name="xmlout" value="500000">
<input type="submit" value="DB2 query (select * animals)" />
</form>

4) Call XMLSERVICE using RPG DB2

This demo shows RPG calling XMLSERVICE.

RPG.html

←Click the image on the left to run the demo (or links below).

Notes:

  • try it (click me) —or— view it (click me) — RPG DB2 using Exec Sql
  • try it (click me) —or— view it (click me) — RPG DB2 using CLI
    • Exec Sql RPG CGI uses profile QTMHHTP1, however PHP is usually running QTMHHTTP, so you may fail authorisation sharing same XMLSERVICE job. Therefore, i recommend use RPG CLI technique to run any profile, where XMLSERVICE job(s) PHP/RPG is no problem.

Author(s)

Tony “Ranger” Cairns - IBM i PHP / PASE