After you create your XPCML file, you need to create a ProgramCallDocument object that can use the XPCML specifications and data values to call a program on your iSeries™ server.
Create an XPCML ProgramCallDocument by passing in the name of your XPCML file on the ProgramCallDocument constructor. Creating an XPCML ProgramCallDocument in this way first parses and validates your XPCML document, then creates the ProgramCallDocument object.
In order to parse and validate the XPCML document, make sure that your CLASSPATH includes a fully validating XML parser. For more information about requirements to run XPCML, see the following page:
Requirements for using XPCML
The following example shows how to create a ProgramCallDocument object for the XPCML file, myXPCML.xpcml.
system = new AS400(); // Create a ProgramCallDocument into which to parse the file. ProgramCallDocument xpcmlDoc = new ProgramCallDocument(system, "myXPCML.xpcml");
The only difference between creating an XPCML ProgramCallDocument and a PCML ProgramCallDocument is that you pass the constructor an XPCML document instead of a PCML document.
After you create the ProgramCallDocument object, use any of the methods of the ProgramCallDocument class to work with your XPCML document. For example, call an iSeries program by using ProgramCallDocument.callProgram() or change the value for an XPCML input parameter before calling the server program by using the appropriate ProgramCallDocument.setValue method.
The following example shows how to create a ProgramCallDocument object for an XPCML file (named myXPCML.xpcml). After creating the ProgramCallDocument object, the example calls a program (PROG1) that is specified in the XPCML document. In this case, the only difference between using XPCML and PCML is that the example passes an XPCML file to the ProgramCallDocument constructor.
After your application reads and parses an XPCML document, the XPCML document functions just like a PCML document. At this point, XPCML can use any of the existing methods that PCML uses.
system = new AS400(); // Create a ProgramCallDocument into which to parse the file. ProgramCallDocument xpcmlDoc = new ProgramCallDocument(system, "myXPCML.xpcml"); // Call PROG1 boolean rc = xpcmlDoc.callProgram("PROG1");