From YiPs Wiki (i powered)

XMLService: XMLSERVICE 123 PHP

(click to open)

Quick Page Table of Contents

Scanning…

XMLSERVICE Zend PHP Toolkit

Goto Main Page
Goto Documents

This page is for IBM i developers that want to try XMLSERVICE.

{Download Demo}

Zend Server includes PHP Toolkit to XMLSERVICE

The Zend Server PHP toolkit can be used from both IBM i (1-tier) and remote to IBM i from Linux, Windows and Mac (2-tier). Here are a few examples from Zend PHP wrapper toolkit calling XMLSERVICE jobs.

Under the covers, PHP toolkit uses the stored procedure interface to XMLSERVICE for safe, reliable transport of the XML input/output documents. Toolkit support can be used with ODBC drivers and DB2 Connect drivers from Windows/Linux or IBM i native (although ibm_db2 DB2 Connect DRDA port 446 is best).

Step 1) Installation

Installation of XMLSERVICE and the PHP toolkit is automatic with Zend Server 5.1.1 and beyond. All configuration is completed with the installation, but you may view the XMLSERVICE documentation from the main page if you want to understand the “plumbing” of this support.

Optional: XMLSERVICE download includes alternate CRTXML2 CL program that updates Zend production library ZZENDSVR RPG - compile into ZENDSVR (see installation).

Step 2) Configuration (fix for CCSID 65535)

IMPORTANT: If you are running a machine with CCSID 65535 (and nothing works), please read and follow the documentation (main XMLSERVICE page), setting valid CCSID like 37 for Apache (web) and/or command line PHP (pear tests).

/www/zendsvr/conf/httpd.conf (web admin GUI port 2001 - ZENDSVR):
DefaultFsCCSID 37  ... or 280 (Italian) ... or so on ...
CGIJobCCSID 37     ... or 280 (Italian) ... or so on ...

Step 3) Example - PGM complex data with DS

Example calling a typical IBM i functions with a few parameters.

How to select odbc or ibm_db2 (laptop)?

//The ToolkitService connection method/function uses either IBM_DB2(default)or ODBC extensions to connect
//to IBM i server. In order to switch to ODBC connection assign an "odbc' value to the $extension varibale
//and make sure that the ODBC extension is enabled in the PHP.INI file. 
$extension='ibm_db2'; 
try {
    $ToolkitServiceObj = ToolkitService::getInstance($db, $user, $pass, $extension);
    }

    catch (Exception $e)
    {             
        echo  $e->getMessage(), "\n";
        exit();
    }

Toolkit use existing DB2 connection?

require_once('ToolkitService.php');

// connect to db using chosen i5 naming mode
$namingMode = DB2_I5_NAMING_ON; // ON or OFF
$db = db2_pconnect('*LOCAL', 'xxxxxxxx', 'xxxxxxxx', array('i5_naming' => $namingMode));

// Connect to Zend API, passing db resource and i5 naming mode instead of dbname/user/password.
$conn = ToolkitService::getInstance($db, $namingMode);

Step 4) Disconnect

How you choose to run your toolkit will greatly affect the overall performance.


Author(s)

Tony “Ranger” Cairns - IBM i PHP / PASE

Retrieved from http://www.youngiprofessionals.com/wiki/index.php/XMLService/XMLSERVICE123PHP
Page last modified on October 18, 2013, at 01:33 PM EST