API Quick Starts (Code Examples) > Invocation API Quick Starts > Quick Start: Invoking a long-lived process using the web service API

Quick Start: Invoking a long-lived process using the web service API
The following C# code example invokes a long-lived process named MortgageLoan - Prebuilt. Notice that this process is invoked asynchronously. This quick start contains a user-defined method named GetDataSource that creates XML data that is passed to the process. The XML data is created using a MSXML2.DOMDocument50Class instance. (See Invoking Human-Centric Long-Lived Processes.)
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.IO; 
 
namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            
            try
			{
				//Create a ReaderExtensionsServiceService client object
                MortgageLoanPrebuiltService mortgageClient = new MortgageLoanPrebuiltService();
                mortgageClient.Credentials = new System.Net.NetworkCredential("administrator", "password");
 
                //Create XML data to send to the long-lived process
                MSXML2.DOMDocument50Class xmlData = getXMLSource();
                XML inXML = new XML();
                inXML.document= xmlData.xml;
 
                //Invoke the long-lived process
                String invocationID = mortgageClient.invoke_Async(inXML);
 
                //Create a Job Manager object to check the 
                //results of an asynchronous request
                JobManagerService jobManager = new JobManagerService();
                jobManager.Credentials = new System.Net.NetworkCredential(
                    "administrator",
                    "password"
                    );
 
                //Create a JobID object that represents the status of the 
                //long-lived operation
                JobId jobId = new JobId();
                jobId.id = invocationID;
                jobId.persistent = true;
                JobStatus jobStatus = jobManager.getStatus(jobId);
                System.Int16 val2 = jobStatus.statusCode;
                Console.WriteLine("The value of the long-lived operation is "+val2); 
            }
 
            catch (System.Exception ee)
            {
                Console.WriteLine(ee.Message);
            }
        }
 
        //Create XML data to pass to the long-lived process
        static private MSXML2.DOMDocument50Class getXMLSource()
        {
 
            MSXML2.DOMDocument50Class myXMLDoc = new MSXML2.DOMDocument50Class();
            MSXML2.IXMLDOMElement MortgageApp = null;
            MSXML2.IXMLDOMElement MortgageFields = null;
            MSXML2.IXMLDOMElement ApplicantFields = null;
            MSXML2.IXMLDOMElement PropertyPrice = null;
            MSXML2.IXMLDOMElement DownPayment = null;
            MSXML2.IXMLDOMElement Term = null;
            MSXML2.IXMLDOMElement Mortgage = null;
            MSXML2.IXMLDOMElement InterestRate = null;
            MSXML2.IXMLDOMElement LastName = null;
            MSXML2.IXMLDOMElement FirstName = null;
            MSXML2.IXMLDOMElement PhoneNumber = null;
            MSXML2.IXMLDOMElement SSN = null;
 
            //Create MortgageApp - the root element in the XML 
            MortgageApp = myXMLDoc.createElement("MortgageApp");
            myXMLDoc.appendChild(MortgageApp); 
 
            //Create Mortgage fields and append it to MortgageApp
            MortgageFields = myXMLDoc.createElement("MortgageFields");
            MortgageApp.appendChild(MortgageFields);
 
            //Create ApplicantFields element and append it to MortgageApp
            ApplicantFields = myXMLDoc.createElement("ApplicantFields");
            MortgageApp.appendChild(ApplicantFields);
 
            //Create the PropertyPrice element - a child to Mortgage fields
            PropertyPrice = myXMLDoc.createElement("PropertyPrice");
            PropertyPrice.appendChild(myXMLDoc.createTextNode("900000"));
            MortgageFields.appendChild(PropertyPrice);
 
            //Create the DownPayment element - a child to Mortgage fields
            DownPayment = myXMLDoc.createElement("DownPayment");
            DownPayment.appendChild(myXMLDoc.createTextNode("100000"));
            MortgageFields.appendChild(DownPayment);
 
            //Create the Mortgage element - a child to Mortgage fields
            Mortgage = myXMLDoc.createElement("Mortgage");
            Mortgage.appendChild(myXMLDoc.createTextNode("800000"));
            MortgageFields.appendChild(Mortgage);
 
            //Create the Term element - a child to Mortgage fields
            Term = myXMLDoc.createElement("Term");
            Term.appendChild(myXMLDoc.createTextNode("20"));
            MortgageFields.appendChild(Term);
 
            //Create the InterestRate element - a child to Mortgage fields
            InterestRate = myXMLDoc.createElement("InterestRate");
            InterestRate.appendChild(myXMLDoc.createTextNode("6.0"));
            MortgageFields.appendChild(InterestRate);
 
            //Create the LastName element - a child to ApplicantFields fields
            LastName = myXMLDoc.createElement("LastName");
            LastName.appendChild(myXMLDoc.createTextNode("White"));
            ApplicantFields.appendChild(LastName);
 
            //Create the FirstName element - a child to ApplicantFields fields
            FirstName = myXMLDoc.createElement("FirstName");
            FirstName.appendChild(myXMLDoc.createTextNode("Sam"));
            ApplicantFields.appendChild(FirstName);
 
            //Create the PhoneNumber element - a child to ApplicantFields fields
            PhoneNumber = myXMLDoc.createElement("PhoneNumber");
            PhoneNumber.appendChild(myXMLDoc.createTextNode("555-5555"));
            ApplicantFields.appendChild(PhoneNumber);
 
            //Create the SSN element - a child to ApplicantFields fields
            SSN = myXMLDoc.createElement("SSN");
            SSN.appendChild(myXMLDoc.createTextNode("123456678"));
            ApplicantFields.appendChild(SSN); 
                        
            return myXMLDoc; 
        }
 
    }
}
 

API Quick Starts (Code Examples) > Invocation API Quick Starts > Quick Start: Invoking a long-lived process using the web service API

Programming with LiveCycle ES (LiveDocs)
Adobe LiveCycle ES Update 1

 

Send me an e-mail when comments are added to this page | Comment Report

Current page: http://livedocs.adobe.com/livecycle/8.2/programLC/programmer/help/000006.html