PCML issues: please heeeeelp! - Websphere

This is a discussion on PCML issues: please heeeeelp! - Websphere ; I'm trying to use PCML to make program calls to our iSeries. All works fine from within WDSCi but I cannot run my app's from Windows Commandline. Finally I decided to start with the example in the JT400 Toolbox but ...

+ Reply to Thread
Results 1 to 3 of 3

Thread: PCML issues: please heeeeelp!

  1. PCML issues: please heeeeelp!

    I'm trying to use PCML to make program calls to our iSeries. All works fine
    from within WDSCi but I cannot run my app's from Windows Commandline.
    Finally I decided to start with the example in the JT400 Toolbox but even
    then, it isn't working!!!

    I get same 'PCML document source 'xxxx' not found exceptions, even when I
    try to serialize the document from command line...

    Help is veeeeeryyyyy muuuuuuch appreciated!


    ************************************************** ********
    JAVACODE:
    ************************************************** ********
    import com.ibm.as400.data.ProgramCallDocument;
    import com.ibm.as400.data.PcmlException;
    import com.ibm.as400.access.AS400;
    import com.ibm.as400.access.AS400Message;

    // Example program to call "Retrieve User Information" (QSYRUSRI) API
    public class qsyrusri {

    public qsyrusri() {
    }

    public static void main(String[] argv)
    {
    AS400 as400System; // com.ibm.as400.access.AS400
    ProgramCallDocument pcml; // com.ibm.as400.data.ProgramCallDocument
    boolean rc = false; // Return code from
    ProgramCallDocument.callProgram()
    String msgId, msgText; // Messages returned from the server
    Object value; // Return value from
    ProgramCallDocument.getValue()

    System.setErr(System.out);

    // Construct AS400 without parameters, user will be prompted
    as400System = new AS400();

    try
    {
    // Uncomment the following to get debugging information
    //com.ibm.as400.data.PcmlMessageLog.setTraceEnabled( true);

    System.out.println("Beginning PCML Example..");
    System.out.println(" Constructing ProgramCallDocument for
    QSYRUSRI API...");

    // Construct ProgramCallDocument
    // First parameter is system to connect to
    // Second parameter is pcml resource name. In this example,
    // serialized PCML file "qsyrusri.pcml.ser" or
    // PCML source file "qsyrusri.pcml" must be found in the
    classpath.
    pcml = new ProgramCallDocument(as400System, "qsyrusri");

    // Set input parameters. Several parameters have default values
    // specified in the PCML source. Do not need to set them using
    Java code.
    System.out.println(" Setting input parameters...");
    pcml.setValue("qsyrusri.receiverLength",
    new
    Integer((pcml.getOutputsize("qsyrusri.receiver"))));

    // Request to call the API
    // User will be prompted to sign on to the system
    System.out.println(" Calling QSYRUSRI API requesting
    information for the sign-on user.");
    rc = pcml.callProgram("qsyrusri");

    // If return code is false, we received messages from the server
    if(rc == false)
    {
    // Retrieve list of server messages
    AS400Message[] msgs = pcml.getMessageList("qsyrusri");

    // Iterate through messages and write them to standard
    output
    for (int m = 0; m < msgs.length; m++)
    {
    msgId = msgs[m].getID();
    msgText = msgs[m].getText();
    System.out.println(" " + msgId + " - " + msgText);
    }
    System.out.println("** Call to QSYRUSRI failed. See messages
    above **");
    System.exit(0);
    }
    // Return code was true, call to QSYRUSRI succeeded
    // Write some of the results to standard output
    else
    {
    value = pcml.getValue("qsyrusri.receiver.bytesReturned");
    System.out.println(" Bytes returned: " + value);
    value = pcml.getValue("qsyrusri.receiver.bytesAvailable");
    System.out.println(" Bytes available: " + value);
    value = pcml.getValue("qsyrusri.receiver.userProfile");
    System.out.println(" Profile name: " + value);
    value =
    pcml.getValue("qsyrusri.receiver.previousSignonDate");
    System.out.println(" Previous signon date:" + value);
    value =
    pcml.getValue("qsyrusri.receiver.previousSignonTime");
    System.out.println(" Previous signon time:" + value);
    }
    }
    catch (PcmlException e)
    {
    System.out.println(e.getLocalizedMessage());
    e.printStackTrace();
    System.out.println("*** Call to QSYRUSRI failed. ***");
    System.exit(0);
    }

    System.exit(0);
    } // End main()

    }

    ************************************************** ********
    PCMLDOCUMENT:
    ************************************************** ********






    usage="output"/>
    usage="output"/>
    usage="output"/>
    usage="output"/>
    usage="output"/>
    usage="output"/>
    usage="output"/>
    usage="output"/>
    usage="output"/>
    usage="output"/>
    usage="output"/>
    usage="output"/>
    usage="output"/>
    usage="output"/>
    usage="output"/>
    usage="output"/>




    usage="output"/>
    usage="input" />
    usage="input" init="USRI0100"/>
    usage="input" init="*CURRENT"/>
    usage="input" init="0"/>




    ************************************************** ********
    ERROR WHILE RUNNING THE JAVAPGM:
    ************************************************** ********
    D:\ClipperJavaApps\resources>java qsyrusri
    Beginning PCML Example..
    Constructing ProgramCallDocument for QSYRUSRI API...
    Exception in thread "main" java.util.MissingResourceException: PCML document
    source 'qsyrusri' cannot be found.
    at
    com.ibm.as400.data.SystemResourceFinder.getPCMLDoc ument(SystemResourceFinder
    ..java:196)
    at com.ibm.as400.data.PcmlSAXParser.(PcmlSAXParser.java:98)
    at
    com.ibm.as400.data.ProgramCallDocument.loadSourceP cmlDocument(Program
    CallDocument.java:1076)
    at
    com.ibm.as400.data.ProgramCallDocument.loadPcmlDoc ument(ProgramCallDocument.
    java:979)
    at
    com.ibm.as400.data.ProgramCallDocument.(ProgramCallDocument.java:127)
    at qsyrusri.main(qsyrusri.java:38)

    ************************************************** ********
    ERROR WHILE TRYING TO SERIALIZE THE PCML-DOCUMENT:
    ************************************************** ********
    D:\ClipperJavaApps\resources>java
    com.ibm.as400.data.ProgramCallDocument -serialize qsyrusri
    Exception in thread "main" java.util.MissingResourceException: PCML document
    source 'qsyrusri' cannot be found.
    at
    com.ibm.as400.data.SystemResourceFinder.getPCMLDoc ument(SystemResourceFinder
    ..java:196)
    at com.ibm.as400.data.PcmlSAXParser.(PcmlSAXParser.java:98)
    at
    com.ibm.as400.data.ProgramCallDocument.loadSourceP cmlDocument(Program
    CallDocument.java:1076)
    at
    com.ibm.as400.data.ProgramCallDocument.main(Progra mCallDocument.java:237)




  2. Re: PCML issues: please heeeeelp!

    Patrick Goovaerts wrote:

    > I'm trying to use PCML to make program calls to our iSeries. All
    > works fine from within WDSCi but I cannot run my app's from Windows
    > Commandline. Finally I decided to start with the example in the
    > JT400 Toolbox but even then, it isn't working!!!
    >
    > I get same 'PCML document source 'xxxx' not found exceptions, even
    > when I try to serialize the document from command line...
    >
    > Help is veeeeeryyyyy muuuuuuch appreciated!


    The PCML document has to be on your classpath. I would also suggest
    giving your document an extension like .pcml as well.

    Serializing the PCML just saves you some parsing at run time, but you
    still have the same classpath issues that the run time has to be able
    to find the serialized file.

    Mark


  3. Re: PCML issues: please heeeeelp!

    classpath issue was also my guess... but couldn't find any forgotten
    configuration. Finally I downloaded the latest JTOpen (JT400.jar) from the
    web and TADAAAA!

    thanks for reply.


    "Mark Phippard" wrote in message
    news:dgmlqj$36bu$1@news.boulder.ibm.com...
    > Patrick Goovaerts wrote:
    >
    > > I'm trying to use PCML to make program calls to our iSeries. All
    > > works fine from within WDSCi but I cannot run my app's from Windows
    > > Commandline. Finally I decided to start with the example in the
    > > JT400 Toolbox but even then, it isn't working!!!
    > >
    > > I get same 'PCML document source 'xxxx' not found exceptions, even
    > > when I try to serialize the document from command line...
    > >
    > > Help is veeeeeryyyyy muuuuuuch appreciated!

    >
    > The PCML document has to be on your classpath. I would also suggest
    > giving your document an extension like .pcml as well.
    >
    > Serializing the PCML just saves you some parsing at run time, but you
    > still have the same classpath issues that the run time has to be able
    > to find the serialized file.
    >
    > Mark
    >




+ Reply to Thread