Invoke concurrent programs in Oracle E-Business Suite using the WCF service model

Oracle E-Business Suite exposes concurrent programs that you can execute to perform specific operations on Oracle applications. Each Oracle application has a set of standard concurrent programs (that are same across all operations) and certain concurrent programs that are specific to an Oracle application. The Oracle E-Business adapter exposes all concurrent programs as operations that adapter clients can invoke. For more information about how the adapter supports concurrent programs, see Operations on Concurrent Programs.

Note

For the concurrent programs that do not expose their metadata, the Oracle E-Business adapter exposes 100 optional parameters for each of these concurrent programs. To invoke these concurrent programs successfully, the user must consult the Oracle E-Business Suite documentation to figure out the parameters for a concurrent program that require a value, and then specify them. An example of such a concurrent program is Journal Import (actual name: GLLEZL) in the General Ledger application.

About the Examples Used in this Topic

The example in this topic invokes the MS_SAMPLE_COPY_EMP_DATA concurrent program, followed by the Get_Status concurrent program to know the status of the first concurrent program. These concurrent programs are invoked from the Application Object Library application. The MS_SAMPLE_COPY_EMP_DATA is created by running the script provided with the samples. For more information about samples, see Samples for the Oracle EBS adapter. A sample, ConcurrentProgram_ServiceModel, which is based on this topic, is also provided with the Oracle E-Business adapter samples.

The WCF Client Class

The name of the WCF client generated for invoking the concurrent programs by the Oracle E-Business adapter is listed in the following table.

Artifact WCF Client Name
Concurrent Program ConcurrentPrograms_[APP_NAME]Client

[APP_NAME] = Actual name of the Oracle E-Business Suite application; for example, FND.

Method Signature for Invoking Concurrent Programs

The following table shows the method signature for the concurrent programs.

Operation Method Signature
Concurrent program public <return type> <Concurrent_program_name>(param 1, param 2, …)

As an example, the following code shows the method signatures for a WCF client class generated for the MS_SAMPLE_COPY_EMP_DATA and Get_Status concurrent programs.

public partial class ConcurrentPrograms_FNDClient : System.ServiceModel.ClientBase<ConcurrentPrograms_FND>, ConcurrentPrograms_FND {      
  
    public string MS_SAMPLE_COPY_EMP_DATA(schemas.microsoft.com.OracleEBS._2008._05.Options.SetOptions SetOptions,  
      schemas.microsoft.com.OracleEBS._2008._05.Options.SetPrintOptions SetPrintOptions,  
      schemas.microsoft.com.OracleEBS._2008._05.Options.SetRepeatOptions SetRepeatOptions,  
      string Description, string StartTime);  
  
    public bool GetStatusForConcurrentProgram(string RequestId, out string Phase, out string Status,  
      out string DevPhase, out string DevStatus, out string Message);  
}  

In this snippet, ConcurrentPrograms_FNDClient is the name of the WCF class in the OracleEBSBindingClient.cs generated by the Add Adapter Service Reference Plug-in. MS_SAMPLE_COPY_EMP_DATA is the name of the method to invoke the concurrent program. GetStatusForConcurrentProgram is the name of the method to invoke the concurrent program to get the status of the first concurrent program.

Note

GetStatusForConcurrentProgram is the actual name of the Get_Status concurrent program.

Creating a WCF Client to Invoke Concurrent Programs

The generic set of actions required to perform an operation on Oracle E-Business Suite using a WCF client involves a set of tasks described in Overview of the WCF service model with the Oracle E-Business Suite adapter. This section describes how to create a WCF client to invoke the MS_SAMPLE_COPY_EMP_DATA and Get_Status concurrent programs.

To create a WCF client

  1. Create a Visual C# project in Visual Studio. For this topic, create a console application.

  2. Generate the WCF client class for the MS_SAMPLE_COPY_EMP_DATA and Get_Status concurrent programs. For more information about generating a WCF client class, see Generate a WCF client or a WCF service contract for Oracle E-Business Suite solution artifacts.

    Important

    Before generating the WCF client class, make sure you set the EnableBizTalkCompatibilityMode binding property to false.

  3. In the Solution Explorer, add reference to Microsoft.Adapters.OracleEBS and Microsoft.ServiceModel.Channels.

  4. Open the Program.cs file and add the following namespaces:

    • Microsoft.Adapters.OracleEBS

    • System.ServiceModel

  5. Open the Program.cs file and create a client as described in the snippet below.

    OracleEBSBinding binding = new OracleEBSBinding();  
    EndpointAddress address = new EndpointAddress("oracleebs://ebs_instance_name");  
    ConcurrentPrograms_FNDClient client = new ConcurrentPrograms_FNDClient(binding, address);  
    

    In this snippet, ConcurrentPrograms_FNDClient is the WCF client defined in OracleEBSBindingClient.cs. This file is generated by the Add Adapter Service Reference Plug-in.

    Note

    In this snippet, you explicitly specify the binding and endpoint address in your application code. You can also use these values from the application configuration file, app.config, also generated by the Add Adapter Service Reference Plug-in. For more information on the different ways of specifying client binding, see Configure a client binding for the Oracle E-Business Suite.

  6. Set the credentials for the client.

    client.ClientCredentials.UserName.UserName = "myuser";  
    client.ClientCredentials.UserName.Password = "mypassword";  
    
  7. Because you are invoking concurrent programs in an Oracle E-Business Suite application, you must set the application context. In this example, to set the application context, you specify the OracleUserName, OraclePassword, and OracleEBSResponsibilityName binding properties. For more information about application context, see Set application context.

    binding.OracleUserName = "myOracleEBSUserName";  
    binding.OraclePassword = "myOracleEBSPassword";  
    binding.OracleEBSResponsibilityName = "myOracleEBSResponsibility";  
    
  8. Open the client as described in the snippet below:

    try  
    {  
       Console.WriteLine("Opening Client...");  
       client.Open();  
    }  
    catch (Exception ex)  
    {  
       Console.WriteLine("Exception: " + ex.Message);  
       throw;  
    }  
    
  9. Invoke the MS_SAMPLE_COPY_EMP_DATA and Get_Status concurrent programs.

    string RequestID;  
    bool Result;  
    string Phase;  
    string Status;  
    string DevPhase;  
    string DevStatus;  
    string Message;  
    
    try  
    {  
        Console.WriteLine("Invoking the MS_SAMPLE_COPY_EMP_DATA concurrent program");  
        RequestID = client.MS_SAMPLE_COPY_EMP_DATA(null, null, null, null, null);  
        Console.WriteLine("The request ID generated for the concurrent program is : " + RequestID);  
        Console.WriteLine("********************************************************");  
        Console.WriteLine("\nWaiting for 60 seconds for the concurrent program to be complete");  
        System.Threading.Thread.Sleep(60000);  
        Console.WriteLine("\nInvoking the Get_Status concurrent program");  
        Result = client.GetStatusForConcurrentProgram(RequestID, out Phase, out Status, out DevPhase, out DevStatus, out Message);  
        Console.WriteLine("\nResult is  : " + Result);  
        Console.WriteLine("Phase is     : " + Phase);  
        Console.WriteLine("Status is    : " + Status);  
        Console.WriteLine("DevPhase is  : " + DevPhase);  
        Console.WriteLine("DevStatus is : " + DevStatus);  
        Console.WriteLine("Message is   : " + Message);  
        Console.WriteLine("********************************************************");  
        Console.WriteLine("\nHit <RETURN> to end");  
        Console.ReadLine();  
    }  
    catch (Exception ex)  
    {  
        Console.WriteLine("Exception : " + ex);  
        throw;                 
    }  
    
  10. Close the client as described in the snippet below:

    client.Close();  
    
  11. Build the project and then run it. The application invokes the MS_SAMPLE_COPY_EMP_DATA and returns a request ID. The ID is then passed to the Get_Status concurrent program, which finally provides the status of the MS_SAMPLE_COPY_EMP_DATA column program.

See Also

Develop Oracle E-Business Suite applications using the WCF Service Model