SERVICE PROGRAM with PHP XML Toolkit Service

SERVICE PROGRAM with PHP XML Toolkit Service

Postby artfabio on Fri Apr 20, 2012 3:58 pm

Hi,

I'm writing a class with the toolkit "PHP XML Toolkit Service."
I wonder how I can call a procedure of a service program.
I tried this script but it does not work and gives me error:

<?php
require_once('ToolkitService.php');

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

$conn = ToolkitService::getInstance($db, $namingMode);

$outParam="";

$param[] = $conn->AddParameterChar('input', 10,'Utente', 'Utente', $user);
$param[] = $conn->AddParameterChar('output', 519,'OutFielDs', 'OutFielDs', $outParam);

$result = $conn->PgmCall("PGMSRV(PROCEDURE)", "LIB", $param, null, null);
...
?>

the error return: "XML header failed",

and this is a part of the log


IPC: '/tmp/nameuser'. Control key: *cdata *sbmjob(ZENDSVR/ZSVR_JOBD/XTOOLKIT)
Stmt: call ZENDSVR/iPLUG512K(?,?,?,?)
Input XML: <?xml version="1.0" encoding="ISO-8859-1" ?><script>

<pgm name='PGMSERV(PROCEDURE)' lib='LIB'>
<parm comment='Utente' io='input'> <data type='10A' var='Utente' >nameuser</data> </parm>
<parm comment='OutFielDs' io='output'> <data type='519A' var='OutFielDs' ></data> </parm>

</pgm>
</script>
Output XML: <?xml version="1.0" encoding="ISO-8859-1" ?>
<report>
<version>XML Toolkit 1.6.7-1a</version>
<error>
<errnopase>2</errnopase>
<errnoxml>1000005</errnoxml>
<xmlerrmsg>PASE resolve failed</xmlerrmsg>
<xmlhint><![CDATA[PGMSERV(PR]]></xmlhint>
</error>
<error>
<errnopase>2</errnopase>
<errnoxml>1100016</errnoxml>
<xmlerrmsg>XML run pgm failed</xmlerrmsg>
<xmlhint><![CDATA[offset 58:<pgm name='PGMSERV(PROCEDURE)' lib='LIB'>
<]]></xmlhint>
</error>

Can you help me? thanks

Fabio
artfabio
 
Posts: 7
Joined: Fri Apr 20, 2012 3:26 pm

Re: SERVICE PROGRAM with PHP XML Toolkit Service

Postby aseiden on Mon Apr 23, 2012 3:30 pm

The procedure name goes in a separate parameter. See documentation here:
http://files.zend.com/help/Zend-Server- ... method.htm

Example:
Code: Select all
$result = $conn->PgmCall("PGMSRV", "LIB", $param, null, "PROCEDURE");

Note, the procedure name is case-sensitive.

--Alan
aseiden
 
Posts: 695
Joined: Thu Apr 09, 2009 5:45 pm

Re: SERVICE PROGRAM with PHP XML Toolkit Service

Postby artfabio on Tue Apr 24, 2012 2:01 pm

Hi Alan,
thanks for the answer, but I still can not resolve the error that PgmCall returns.
I have to launch a service program with two parameters, one input and one output.
So I wrote:

$ namingMode DB2_I5_NAMING_ON = / / ON or OFF
$ db = db2_pconnect ('* LOCAL', $ user, $ pwd, array ('i5_naming' => $ namingMode));

$ conn = ToolkitService :: getInstance ($ db, $ namingMode);
OutParam $ = "";

$ param [] = $ conn-> AddParameterChar ('input', 10, 'User', 'User', $ user);
$ param [] = $ conn-> AddParameterChar ('output', 519, 'OutFielDs', 'OutFielDs', $ OutParam);

$ result = $ conn-> PgmCall ("MNSER00", "ARTM_OBJ", $ param, null, "RTVAZIPRE");

if ($ result) {
print_r ($ result ['io_param']);
var_dump ($ result);
}
else {
ECHO "Execution failed. \ N";
print ($ conn-> getErrorMsg ());
var_dump ($ result);
}

$ conn-> disconnectPersistent ();


The error that comes back to me is: XML header failed (failure)
Can you help me? I do not understand where the mistake.
Thanks, Fabio
artfabio
 
Posts: 7
Joined: Fri Apr 20, 2012 3:26 pm

Re: SERVICE PROGRAM with PHP XML Toolkit Service

Postby aseiden on Tue Apr 24, 2012 3:20 pm

Hi, Fabio,

We are getting closer. Stick with it and we will resolve this soon.

One note:
Use 'in' and 'out', not 'input' and 'output' (the documentation was wrong).

Please run in again in debug mode and post the debug.log file (full input and output xml).

I'll review the log and tell you what I think.

Best,
Alan
aseiden
 
Posts: 695
Joined: Thu Apr 09, 2009 5:45 pm

Re: SERVICE PROGRAM with PHP XML Toolkit Service

Postby artfabio on Tue Apr 24, 2012 3:37 pm

Alan,
I'm sorry, but replace "in" and "out" does not work, the error is still the one: XML header failed (failure).
I send you the log:

Creating new database with conn: 'Resource id # 4', i5 naming or user flags: '1 ', ext prefix:'', persistence:''
Re-using an existing connection with db schema separator: /
Exec start: 04/24/2012 16:31:12
IPC: '/ tmp / Toolkit'. Control Key: * cdata * SBMJOB (ZENDSVR / ZSVR_JOBD / XToolkit)
Stmt: ZENDSVR/iPLUG512K call (?,??,?)
Input XML: <? Xml version = "1.0" encoding = "ISO-8859-1"?> <script>

<pgm name='MNSER00' lib='ARTM_OBJ' func='R'>
<parm comment='Utente' io='in'> <date type='10A' var='Utente'> FABIO </ date> </ parm> <parm comment='OutFielDs' io='out'> <data '519A type = 'var =' OutFielDs'> </ data> </ parm>

</ Pgm>
</ Script>
XML output: <? Xml version = "1.0" encoding = "ISO-8859-1"?>
<report>
<version> XML Toolkit 1.6.7-1a </ version>
<error>
<errnoile> 3457 </ errnoile>
<errnoxml> 1001001 </ errnoxml>
<xmlerrmsg> XML header failed </ xmlerrmsg>
<xmlhint> <! [CDATA [failure]]> </ xmlhint>
</ Error>
<error>
<errnopase> 2 </ errnopase>
<errnoxml> 1000008 </ errnoxml>
<xmlerrmsg> ILESYM failed </ xmlerrmsg>
<xmlhint> <! [CDATA [R]]> </ xmlhint>
</ Error>
<error>
<errnopase> 2 </ errnopase>
<errnoxml> 1100016 </ errnoxml>
<xmlerrmsg> XML failed run pgm </ xmlerrmsg>
<xmlhint> <! [CDATA [Offset 58: <pgm name='MNSER00' lib='ARTM_OBJ' func='R'>
<pa]]> </ xmlhint>
</ Error>
<joblog job='XTOOLKIT' user='FABIO' nbr='150940'> <! [CDATA [5722SS1 V5R4M0 060210 Visual. Rec. labor S06C2784 04/24/12 16:31:14 Page 1
Name of work. . . . . . : XToolkit User. . . . . : Fabio Number. . . . . . . . . . . : 150940
Description of work. . . : ZSVR_JOBD Library. . . . : ZENDSVR
IDMSG TYPE SEV DATE TIME FROM LIBRARY INST PROG PROG A LIBRARY INST
CPF1124 Information 00 24/04/12 16:31:12,699648 QSYS 0671 * EXT * QWTPIIPP N
Message. . . : Work started on 24/04/12 at 150940/FABIO/XTOOLKIT
16:31:12 in subsystem ZENDSVR in ZENDSVR. Work entered in the system
24/04/12 at 16:31:12 ..
CPI1125 Information 00 24/04/12 16:31:12,712936 QWTPCRJA QSYS 010F * EXT * N
Message. . . : It 'entered the work 150940/FABIO/XTOOLKIT.
Cause. . . . . : The work was placed in the queue 150940/FABIO/XTOOLKIT
works in ZSVR_JOBQ ZENDSVR 150676/QUSER/QSQSRVR from work. The work
150940/FABIO/XTOOLKIT was started with the command input of a job
(SBMJOB) with the following attributes: JOBPTY (5) OUTPTY (5) PRTTXT ()
RTGDTA (QCMDB) SYSLIBL (QSYS2 QHLPSYS QSYS QUSRSYS) CURLIB (QGPL)
INLLIBL (ZENDSVR QGPL QTEMP) INLASPGRP (* NONE) LOG (4 00 * nolist)
LOGCLPGM (* YES) LogOutput (* JOBEND) OUTQ (/ * DEV) PRTDEV (PRT01) INQMSGRPY (* RQD)
HOLD (* NO) DATE (* SYSVAL) SWS (00000000) MSGQ (QUSRSYS / FABIO) CCSID (65535)
SRTSEQ (* N / * HEX) LANGID (ITA) CNTRYID (IT) JOBMSGQMX (16) JOBMSGQFL (* WRAP)
ALWMLTTHD (* NO) SPLFACN (* KEEP).
* NONE Request 24/04/12 * N QCMD QSYS 16:31:12,713096 QWTSCSBJ 0194
Message. . . :-CALL PGM (ZENDSVR / XMLSERVICE) PARM ('/ tmp / Toolkit')]]>
</ Joblog>
</ Report>

Exec end: 24/04/2012 16:31:16. Seconds to execute: 3.4752089977264.


Exec start: 04/24/2012 16:31:16
IPC: '/ tmp / Toolkit'. Control Key: * immed
Stmt: ZENDSVR/iPLUG512K call (?,??,?)
Input XML: <? Xml version = "1.0" encoding = "ISO-8859-1"?>
XML output:
Exec end: 24/04/2012 16:31:16. Seconds to execute: 0.0064148902893066.

And db disconnect requested are done.

Best,
Fabio
artfabio
 
Posts: 7
Joined: Fri Apr 20, 2012 3:26 pm

Re: SERVICE PROGRAM with PHP XML Toolkit Service

Postby aseiden on Thu Apr 26, 2012 3:00 am

Hi, Fabio,

I wonder why the input XML shows:
Code: Select all
<pgm name='MNSER00' lib='ARTM_OBJ' func='R'>

Notice, it says func='R'

when you specified
Code: Select all
$ result = $ conn-> PgmCall ("MNSER00", "ARTM_OBJ", $ param, null, "RTVAZIPRE");

with the last parameter "RTVAZIPRE", not "R".

Do you know why the RTVARIPRE changed to R?

If you'd like, send your actual PHP script file to alan@alanseiden.com and I'll test it.

Alan
aseiden
 
Posts: 695
Joined: Thu Apr 09, 2009 5:45 pm

Re: SERVICE PROGRAM with PHP XML Toolkit Service

Postby jeffmorrill on Thu Apr 26, 2012 4:55 pm

I am also seeing the procedure name being truncated to one character in the xml. Did anyone figure out why this happens?
jeffmorrill
 
Posts: 2
Joined: Thu Apr 26, 2012 4:53 pm

Re: SERVICE PROGRAM with PHP XML Toolkit Service

Postby jeffmorrill on Thu Apr 26, 2012 5:45 pm

I figured out why my procedure name was being truncated. The routine that builds the XML is looking for the last parameter of PgmCall to be an array ie.

Code: Select all
array('func'=>'PROCEDURE_NAME')
jeffmorrill
 
Posts: 2
Joined: Thu Apr 26, 2012 4:53 pm

Re: SERVICE PROGRAM with PHP XML Toolkit Service

Postby aseiden on Fri Apr 27, 2012 4:49 am

Jeff,

Thanks for pointing that out. The fifth parameter accepts various options, including the function/procedure name.

For Fabio,the last parameter should be:
array('func' => "RTVAZIPRE")

making the complete PgmCall:
Code: Select all
$result = $conn->PgmCall("MNSER00", "ARTM_OBJ", $param, null, array('func' => "RTVAZIPRE"));


I apologize for my mistake earlier....I'm not at my office and was answering too quickly.

Alan
aseiden
 
Posts: 695
Joined: Thu Apr 09, 2009 5:45 pm


Return to New Toolkit

Who is online

Users browsing this forum: No registered users and 1 guest