PreviousNext
Help > XML Easycom > Introduction to XML Easycom
Introduction to XML Easycom

XML Easycom is an interface to describe and call native IBM i Procedure and Programs, using an XML protocol.

PHP developers don’t necessarily have to take care about XML. A set of API functions is provided:

i5_XmlDefine

i5_XmlBindSrvPgm

i5_XmlCallProgram

i5_XmlLoadDefinition

i5_XmlExecRequest

Original RPG sources can be used by PHP scripts to describe data structures, procedures, and programs.

 

Example of PHP script:

 

 

$Ret = i5_XmlLoadDefinition ("RPG", 'EASYCOMXMP/QRPGLESRC,CVTNW_H');

$ret = i5_XmlBindSrvPgm ("XMPSRVPGM"); 

$ArrayIn = array('LIMIT'=>150, 'DECV'=>12345);

$ArrayOut = i5_XmlCallProgram ("FCVTNW", $ArrayIn, "RetVal");

echo 'Return value = '.$RetVal.'<br>';

 

XML Easycom is independent from Easycom server. It can be loaded as an extension to Easycom, or as an independent service into an IBM i job or PASE application, such as PHP.

 

XML Easycom server receives requests from client applications in XML format, and it returns back answer data in XML format too. Client application gets APIs to easily build requests and retrieve results.

 

An application sends Xml request to XmlEasycom server to:

     Bind Service Programs to the server job.

     Load native program and procedure definitions from RPG or PCML source.

     Execute system commands

     Call native program and procedure.

 

A typical application bind service programs to the job once, when job is initiated, then it loads Program and Procedure definitions once, so that prototypes are known by the system when subsequent calls are issued.

 

An XML Easycom request consists of the following tags:

     <Define> tag: Includes program and structure definitions, and procedure prototypes.

     <Bind> tag: Binds a service program to the job and makes all its procedure accessible.

     <System> tag: Executes immediately a system command. This tag has no meaning when XML Easycom is an extension to Easycom Server.

     <Include> Tag: Includes an XML file containing XML Easycom tags.

     <Program> tag: Calls a program or procedure, passing input parameters.

XML Easycom tags can be included in one root tag: <Easycom>.

Each tag has its own attributes and tags.

 

Example: Bind service program, and load procedure definitions from RPG and PCML.

 

<?xml version="1.0" encoding="ISO-8859-1" ?>

<Easycom>

    <system IGNMSG="CPF2103" Command="addlible PCXML"/>

    <bind>

                   <file type="*SRVPGM" name="RPGPRC01"/>

    </bind>

    <define>

                   <file type="RPG"  pf-src="CVTNW_H"/>

                   <file type="PCML" stmf="/tmp/sr/CUST_DIM.pcml" />

                   <S-RPG>

DS_CUST   E DS  extname(SP_CUST:RSP_CUST);

PSPCUST   PR;

                                   Result    LIKEDS(DS_CUST);

                                   TERM1     5S 0;

                   </S-RPG>

  </define>

</Easycom>

 

Example: Call a program, passing input parameter value.

 

<?xml version="1.0" encoding="ISO-8859-1" ?>

<Easycom>

  <Program Name="PSPCUST">

                   <parameterList>

                                   <Term1>01551</Term1>

                   </parameterList>

  </Program>

</Easycom>

 

Return data from Call.

 

<?xml version="1.0" ?>

<Program name="PSPCUST">

  <ParameterList>

    <RESULT Type="Struct">

                   <CUST_ID>1551</CUST_ID>

                   <COMPANY>Marmot Divers Club</COMPANY>

                    <FIRSTNAME>Joyce</FIRSTNAME>

                    <LASTNAME>Marsh</LASTNAME>

                   <CIVIL>2</CIVIL>

                   <ADDRESS>872 Queen St.</ADDRESS>

                   <ADDR2></ADDR2>

                   <CITY>Kitchener</CITY>

                   <STATE>Ontario</STATE>

                   <ZIP>G3N 2E1</ZIP>

                   <COUNTRY>Canada</COUNTRY>

                   <PHONE>416-698-0399</PHONE>

                    <FAX>426-698-0399</FAX>

    </RESULT>

    <TERM1>1551</TERM1>

  </ParameterList>

 </Program>