asynchronously invoke odi scenario from bpel process with callback
TRANSCRIPT
09/07/12 Asynchronously Invoke ODI Scenario from BPEL Process with Callback
1/70oracle.com/webfolder/technetwork/tutorials/obe/fmw/odi/10g/10135/…/odiscenario_bpelcallback.htm
Asynchronously Invoking the ODI Scenario from the BPEL Process with Callback
Purpose
This tutorial walks you through the steps that are needed to manage a long-running Oracle Data Integrator (ODI) Scenario from the BPEL Process by invoking the ODIscenario asynchronously using callbacks. This demonstrates a more advanced approach by wrapping the ODI scenario with a Java service to manage the asynchronouscommunication with the BPEL process.
Time to Complete
Approximately 1 hour and 30 minutes
Topics
This OBE tutorial covers the following topics:
Overview
Scenario
Verifying the Prerequisites
Creating a New Application in JDeveloper and Deploying the ODI Wrapper Service to the Oracle Application Server
Creating a New BPEL Process
Updating the BPEL Process Interface
Creating a Partner Link Representation of the ODIInvokerService
Creating BPEL Preferences to Dynamically Update Process-Level Values
Assigning the ODIStarterWebservice Input Values
Encrypting and Setting the Password for the Callback
Receiving the Asynchronous Reply
Catching Possible Remote Faults
Setting Default Input for Invoking the Process
Deploying Your BPEL Project
Testing the Process
Summary
Viewing Screenshots
Place the cursor over this icon to load and view all the screenshots for this tutorial. (Caution: Because this action loads all screenshots simultaneously, the
response time may be slow depending on your Internet connection.)
Note: Alternatively, you can place the cursor over each individual icon in the following steps to load and view only the screenshot associated with that step.
The screenshots will not reflect the specific environment that you are using. They are provided to give you an idea of where to locate specific functionality in Oracle DataIntegrator.
Overview
ODI provides a synchronous and asynchronous Web services interface for applications to invoke ODI scenarios out of the box. Currently, ODI can execute a Web serviceasynchronously, but when the Web service is completed, it cannot reference back to the ODI job and signal that it completed successfully or failed. The callbackreference allows ODI to call a Web service asynchronously and the Web service then knows where to call back ODI when the job is finished, to signal theoutcome of the job. If a BPEL business process uses this interface to invoke a large, long-running load, it is likely that the synchronous invocation will time out before theODI load is complete. In this example, you deploy a Java Web service (ODIInvokerService) as an intermediary between BPEL and ODI. BPEL invokes the Java service andpasses the ODI scenario details. The Java service then invokes the ODI load through the ODI API. When the load is complete, the Java service asynchronously calls backthe BPEL instance through the BPEL PM’s Java API, or by changing a parameter within the invocation of the Web service. The callback is performed using WS addressing.Thus, BPEL can asynchronously interact with long-running ODI loads. The Java service is built generically so that any ODI scenario can be called from any Web serviceprocess.
Back to Topic List
Scenario
Linda works as a database administrator for Global Enterprise. In Global Enterprise, Linda is responsible for performing database management and integration tasks onvarious resources within the organization. In particular, Linda is responsible for data loading, transformation, and validation. She needs to manage long-running OracleData Integrator (ODI) scenarios from BPEL processes. If the BPEL business process uses this interface to invoke a large, long-running load, the synchronous invocationwill time out before the ODI load is complete. For that reason, Linda makes a decision to invoke the ODI scenarios asynchronously using callbacks.
Back to Topic List
Verifying the Prerequisites
Before you start the tasks, make sure that your system environment meets the following requirements:
Software Requirements
The system should include the following installed products:
09/07/12 Asynchronously Invoke ODI Scenario from BPEL Process with Callback
2/70oracle.com/webfolder/technetwork/tutorials/obe/fmw/odi/10g/10135/…/odiscenario_bpelcallback.htm
Oracle SOA Suite 10g (10.1.3.1.0)
Oracle Database 10g XE
Oracle Data Integrator 10g (10.1.3.4)
Oracle JDeveloper 10.1.3.1 Studio Edition
The Oracle Data Integrator 10.1.3.4.2 patch from Metalink. To obtain this patch, perform the following steps:
1. Go to http://metalink.oracle.com.
2. Log in with your username and password.
3. Click the Patches and Updates tab, and then click Simple Search.
4. From the Search By drop-down list, select Product or Family and enter odi.
5. Click Go to download.
The Axis2 1.2 framework. To install this, perform the following steps:
1. Go to http://www.mirrorgeek.com/apache.org/ws/axis2/1_2/axis2.war and download axis2.war to C:\temp.
2. Deploy the axis2 application to OC4J using the following command: java -jar admin_client.jar
deployer:oc4j:opmn://localhost:6004/as1013/home oc4jadmin oracle1
-deploy -file c:\temp\axis2.war -deploymentName axis2 -contextRoot
/axis2.
3. Access the Axis2 page by using the URL http://localhost:8888/axis2/axis2-web/index.jsp.
4. Log in using admin as the Username and axis2 as the Password.
The system should include the following configuration:
odi-public-ws.aar must be deployed in Axis2. Use the Upload Service link on the Axis2 admin page to upload this file (download from here).The ODI Master and Work repository must be created. You can refer to the steps from here.The xml, xtd, and csv files for the examples must be available. For example, the GEO_DIM.xml file that is included with this sample has much data and isapproximately 8 MB to demonstrate using a moderately sized XML file with ODI and BPEL. You can download the complete set of demo/xml files from here.The schema (ODI_STAGE) for the target tables of the exercise and a data server and physical schema for this schema must be available within the ODI TopologyManager. To do this, perform the following steps:
Start the Oracle Database 10g XE Administrative Console.Log in using system as the Username and oracle1 as the Password.From the Enterprise Manager Console, select Administration > Database Users > Create Users.Provide the username as ODI_STAGE and password as oracle1.Select the DBA check box and click Create. Note that the ODI_STAGE user is created.Select Start > All Programs > Oracle > Oracle Data Integrator > Topology Manager to open the ODI Topology Manager.Scroll down the pane at the bottom left to click the Physical Architecture tab.At the top-left corner, under the Physical Architecture pane, click "+" to expand Technologies > Oracle.Right-click Oracle and select Insert Data Server.The Data Server: new Window appears. Enter the name as Local_XE, Instance / dblink (Data Server) as XE, User as ODI_STAGE, and password asoracle1. Next, click the JDBC tab.For the JDBC Driver value, click the Browse button and select Oracle JDBC Driver from the Name drop-down list. Click OK.For the JDBC Url value, click the Browse button and select jdbc:<hostname>:<port>:<sid>. Click OK. Populate the values as per your environment details.Click Test, Test again, and then click OK.Click OK in the Data Server: new window.Under the Physical Architecture pane, click "+" to expand Technologies > Oracle > Local_XE.In the Physical Schema: Local_XE.Schema window, under the Definitions tab, select ODI_STAGE from the Schema (Schema) drop-down list andODI_STAGE from the Schema (Work Schema) drop-down list.Click the Context tab.Click Add context. Select Global from the Context drop-down list and set Logical Schema as ODI_STAGE.Click OK.
This example uses a number of supplied files and the sources, which are located in the OBE_LABS directory. Download the OBE_LABS.zip file from here andextract them into your machine in the same directory as JDeveloper (for example: G:\OBE_LABS).
If not done before, start the services and components for Database 10g XE, Oracle Data Integrator 10g (10.1.3.4), and Oracle SOA Suite 10g.
It is required that you complete the OBE titled Developing an ODI XML Transformation That Can Be Executed Within a BPEL Process before attempting this OBE. It isalso recommended that you complete the OBE titled Creating an ODI Error Hospital That Uses the BPEL Human Workflow.
Back to Topic List
Creating a New Application in JDeveloper and Deploying the ODI Wrapper Service to the Oracle Application Server
In this part of the example, you deploy the Java Wrapper Service, ODIInvokerService, to the Oracle Application Server. To create a new application and deploy the ODIwrapper service to the Oracle Application Server, perform the following steps:
1. Start JDeveloper by clicking jdeveloper.exe in G:\jdevStudio10131. Alternatively, use the SOA Suite JDeveloper shortcut on the desktop.If a dialog box opens that asks if you would like to migrate from a previous version of JDeveloper, click No. In the Applications Navigatoron the left, right-click Applications and select New Application.
09/07/12 Asynchronously Invoke ODI Scenario from BPEL Process with Callback
3/70oracle.com/webfolder/technetwork/tutorials/obe/fmw/odi/10g/10135/…/odiscenario_bpelcallback.htm
2. In the window that opens, enter BPEL2ODIAsync in the Application Name field. Click OK.
3. In the Create Project window that appears, click Cancel. The BPEL2ODIAsync application appears in the Applications Navigator.
4. Select File > Open. Browse to the G:\ODIInvokerService_generation2 directory and select the ODIInvokerService.jpr file. Click Openand the ODIInvokerService appears in the Applications Navigator.
Note: At this point, you have imported the Java Wrapper Service (ODIInvokerService) that acts as the intermediary between BPEL andODI. It is recommended that you take some time to browse the classes and details of the service to gain an understanding of how itworks. Note that the Java application contains two interfaces: a synchronous Web service interface (ODIAsyncStarterWebService) anda stand-alone Java interface (odi-async-standalone.jar). You will be invoking the Web service interface, which requires to pass callbackinformation to call back the correct BPEL instance via the BPEL API and the ODI information to invoke the correct ODI scenario via theODI API.
09/07/12 Asynchronously Invoke ODI Scenario from BPEL Process with Callback
4/70oracle.com/webfolder/technetwork/tutorials/obe/fmw/odi/10g/10135/…/odiscenario_bpelcallback.htm
6. To configure the library locations that will be used at run time, right-click the ODIInvokerService in the Applications Navigator and selectProject Properties. In the window that opens, select Libraries from the Explorer on the left. From the Libraries list, select theOrabpel.jar library and click Edit. On the Edit Library Definition window, highlight the current Class Path value and click Remove.
09/07/12 Asynchronously Invoke ODI Scenario from BPEL Process with Callback
5/70oracle.com/webfolder/technetwork/tutorials/obe/fmw/odi/10g/10135/…/odiscenario_bpelcallback.htm
09/07/12 Asynchronously Invoke ODI Scenario from BPEL Process with Callback
6/70oracle.com/webfolder/technetwork/tutorials/obe/fmw/odi/10g/10135/…/odiscenario_bpelcallback.htm
7. Highlight Class Path: and click Add Entry. Browse to your SOA_HOME/bpel/lib directory (E:\SOASuite10131\bpel\lib) and selectorabpel.jar (if you get this library from another location, ensure that it is the same version as your installed SOA Suite). Click Select. Onthe Edit Library Definition window, ensure that the Deployed by Default check box is selected and click OK.
09/07/12 Asynchronously Invoke ODI Scenario from BPEL Process with Callback
7/70oracle.com/webfolder/technetwork/tutorials/obe/fmw/odi/10g/10135/…/odiscenario_bpelcallback.htm
09/07/12 Asynchronously Invoke ODI Scenario from BPEL Process with Callback
8/70oracle.com/webfolder/technetwork/tutorials/obe/fmw/odi/10g/10135/…/odiscenario_bpelcallback.htm
8. Similarly, from the Libraries list, select the Orabpel-common.jar library and click Edit. In the window that appears, highlight the currentClass Path value and click Remove. Highlight Class Path: and click Add Entry. Browse to your SOA_HOME/bpel/lib directory(E:\SOASuite10131\bpel\lib) and select orabpelcommon.jar (if you get this library from another location, ensure that it is the sameversion as your installed SOA Suite). On the Edit Library Definition window, ensure that the Deployed by Default check box is selectedand click OK.
09/07/12 Asynchronously Invoke ODI Scenario from BPEL Process with Callback
9/70oracle.com/webfolder/technetwork/tutorials/obe/fmw/odi/10g/10135/…/odiscenario_bpelcallback.htm
09/07/12 Asynchronously Invoke ODI Scenario from BPEL Process with Callback
10/70oracle.com/webfolder/technetwork/tutorials/obe/fmw/odi/10g/10135/…/odiscenario_bpelcallback.htm
9. On the Project Properties page, make sure that Export is selected for all the libraries that you edited and click OK. From the ApplicationsNavigator, right-click ODIInvokerService and select Rebuild.
10.To deploy the Java service, ensure that you have a connection configured in JDeveloper to your application server, and that it is up andrunning. In the Applications Navigator, expand Applications > BPEL2ODIAsync > ODIInvokerService > Resources. Right-clickWebServices.deploy and select Deploy to > your application server connection (for example, SoademoApplicationServer as shown
09/07/12 Asynchronously Invoke ODI Scenario from BPEL Process with Callback
11/70oracle.com/webfolder/technetwork/tutorials/obe/fmw/odi/10g/10135/…/odiscenario_bpelcallback.htm
in the screenshot). Click OK in any windows that appear. The Deployment Log appears at the bottom of the page and displays amessage indicating that the deployment is complete as shown below.
11.To verify that the service is deployed and accessible, open Application Server Control in a browser (http://localhost:8888/em/). Log inusing your administrator credentials (User name: oc4jadmin and Password: welcome1). On the Enterprise Manager page, select theoc4j container to which you deployed ODIInvokerService (Home JVMs). On the OC4J Home page, click the Applications tab. On theApplications tab, under default, locate and select the odi-webservice application.
09/07/12 Asynchronously Invoke ODI Scenario from BPEL Process with Callback
12/70oracle.com/webfolder/technetwork/tutorials/obe/fmw/odi/10g/10135/…/odiscenario_bpelcallback.htm
12.On the odi-webservice page, click the Web Services tab, and then click the Test Service button.
09/07/12 Asynchronously Invoke ODI Scenario from BPEL Process with Callback
13/70oracle.com/webfolder/technetwork/tutorials/obe/fmw/odi/10g/10135/…/odiscenario_bpelcallback.htm
13.On the new page, retain the default URL and click Test Web Service. Click the Test Service button. The ODIAsyncStarterWebservicepage appears. It contains an HTML form to invoke ODIInvokerService as well as links to the WSDL service definition anddocumentation. Click the Service Description link. In JDeveloper, save your work by selecting File > Save All.
Note: Do not close the last page that you opened as you need it to copy the WSDL URL location in the next section. At this point, you donot test the service but you can see the input fields that are used to call the ODI scenario, and then call back to the BPEL process. TheODIINvokerService is now deployed and ready to run.
09/07/12 Asynchronously Invoke ODI Scenario from BPEL Process with Callback
14/70oracle.com/webfolder/technetwork/tutorials/obe/fmw/odi/10g/10135/…/odiscenario_bpelcallback.htm
Back to Topic List
Creating a New BPEL Process
To create a new BPEL process, perform the following steps:
1. In the Applications Navigator on the left, right-click BPEL2ODIAsync and select New Project. In the window that appears, selectBPEL Process Project and click OK.
09/07/12 Asynchronously Invoke ODI Scenario from BPEL Process with Callback
15/70oracle.com/webfolder/technetwork/tutorials/obe/fmw/odi/10g/10135/…/odiscenario_bpelcallback.htm
2.On the BPEL Project Creation Wizard screen, name the project AsyncODICall and ensure that Asynchronous BPEL Process isselected. Click Next. Click the Flashlight icon next to the Input Schema Element field. Browse to your OBE_LABS directory andselect ODIService.xsd. Click Open.
09/07/12 Asynchronously Invoke ODI Scenario from BPEL Process with Callback
16/70oracle.com/webfolder/technetwork/tutorials/obe/fmw/odi/10g/10135/…/odiscenario_bpelcallback.htm
09/07/12 Asynchronously Invoke ODI Scenario from BPEL Process with Callback
17/70oracle.com/webfolder/technetwork/tutorials/obe/fmw/odi/10g/10135/…/odiscenario_bpelcallback.htm
3. In the Type Chooser window, expand Imported Schemas > ODIService.xsd and select ODIProcessRequest. Click OK.
4.Click the Flashlight icon next to the Output Schema Element field. In the Type Chooser window, expand Imported Schemas >ODIService.xsd and select ODIProcessResponse. Click OK.
09/07/12 Asynchronously Invoke ODI Scenario from BPEL Process with Callback
18/70oracle.com/webfolder/technetwork/tutorials/obe/fmw/odi/10g/10135/…/odiscenario_bpelcallback.htm
5.Click Finish on the BPEL Project Creation Wizard screen. Your new AsyncODICall project opens in the main JDeveloper window.Save your project (select File > Save All).
09/07/12 Asynchronously Invoke ODI Scenario from BPEL Process with Callback
19/70oracle.com/webfolder/technetwork/tutorials/obe/fmw/odi/10g/10135/…/odiscenario_bpelcallback.htm
Back to Topic List
Updating the BPEL Process Interface
In the steps that follow, you modify the BPEL process interface that is created by default to include two new operations. These two operations are added to the inbound porttype in WSDL. They are used to receive the asynchronous response from ODIInvokerService that you deployed earlier.
To update the BPEL process interface, perform the following steps:
1. In the Application Navigator on the left, expand BPEL2ODIAsync > AsyncODICall > Integration Content and double-click
AsyncODICall.wsdl to open it. In the AsyncODICall.wsdl file, click the Switch View button at the top left. With theAsyncODICall.wsdl file open in the main pane, locate the Structure pane (you may need to click View > Structure). Expanddefinitions and right-click Messages. Select Insert Message. In the window that appears, name the messageODIInvokerServiceResponseMessage. Click OK.
09/07/12 Asynchronously Invoke ODI Scenario from BPEL Process with Callback
20/70oracle.com/webfolder/technetwork/tutorials/obe/fmw/odi/10g/10135/…/odiscenario_bpelcallback.htm
2.Right-click ODIInvokerServiceResponseMessage and select Insert inside message - ODIInvokerServiceResponseMessage >http://schemas.xmlsoap.org/wsdl/ > part. In the window that appears, name the part payload. Select the Reference Type to beelement. Enter ns1:ODIInvokerServiceResponse in the Part Type field. Click OK.
3.Similarly, in the Structure pane, expand definitions and right-click Messages. Select Insert Message. In the window thatappears, name the message ODIInvokerServiceFaultMessage. Click OK. Right-click the ODIInvokerServiceFaultMessage andselect Insert inside ODIInvokerServiceFaultMessage >http://schemas.xmlsoap.org/wsdl > part. Name the part payload. Selectthe Reference Type to be element. Enter ns1:ODIInvokerServiceFault in the Part Type field. Click OK.
09/07/12 Asynchronously Invoke ODI Scenario from BPEL Process with Callback
21/70oracle.com/webfolder/technetwork/tutorials/obe/fmw/odi/10g/10135/…/odiscenario_bpelcallback.htm
4.Verify that your AsyncODICall.wsdl has the structure as shown below.
5.Under Port Types, select and right-click AsyncODICall. Select Insert inside AsyncODICall > http://schemas.xmlsoap.org/wsdl/> operation. In the window that appears, name the operation onODIResult. Select One Way from the Operation Type drop-downlist. Select client:ODIInvokerServiceResponseMessage from the Input drop-down list and click OK. A new operation appearsunder initiate.
09/07/12 Asynchronously Invoke ODI Scenario from BPEL Process with Callback
22/70oracle.com/webfolder/technetwork/tutorials/obe/fmw/odi/10g/10135/…/odiscenario_bpelcallback.htm
6.Again under Port Types, select and right-click AsyncODICall. Select Insert inside AsyncODICall >http://schemas.xmlsoap.org/wsdl/ > operation. In the window that appears, name the operation onODIError. Select One Wayfrom the Operation Type drop-down list. Select client:ODIInvokerServiceFaultMessage from the Input drop-down list and clickOK. A new operation appears under initiate.
7.Verify that your AsyncODICall.wsdl has the structure as shown below. Save your project (select File > Save All) and close theAsyncODICall.wsdl file. Click the AsyncODICall.bpel file tab and click the green check mark at the top of the page. This shouldrefresh the BPEL process with the changes that you just made (you may have to close and reopen the BPEL file for the changesto take effect).
Note: You have now updated the BPEL interface by creating two new operations: onODIResult and onODIError.
09/07/12 Asynchronously Invoke ODI Scenario from BPEL Process with Callback
23/70oracle.com/webfolder/technetwork/tutorials/obe/fmw/odi/10g/10135/…/odiscenario_bpelcallback.htm
Back to Topic List
Creating a Partner Link Representation of ODIInvokerService
In the following steps, you create a BPEL Partner Link that represents the Java Wrapper Service ODIInvokerService. To create the Partner Link representation of theODIInvokerService, perform the following steps.
1. From the Components Palette, select PartnerLink and drag it into the gray Services swim lane to the right of thediagram. In the Create Partner Link window, name this Partner Link ODIAsyncStarterWebservice. Copy theWSDL URL for the deployed ODIInvokerService from the Oracle Application Server Control page (you should haveit open in the browser) and paste it into the WSDL File field in the Create Partner Link window. Click the bluedouble arrow button to refresh the page. A window appears that asks whether you would like it to create thepartner links for you. Click Yes.
09/07/12 Asynchronously Invoke ODI Scenario from BPEL Process with Callback
24/70oracle.com/webfolder/technetwork/tutorials/obe/fmw/odi/10g/10135/…/odiscenario_bpelcallback.htm
2. From the Partner Link Type drop-down list, select ODIAsyncStarterWebservice_PL. From the Partner Role drop-
down list, select ODIAsyncStarterWebservice_Role. Leave the other fields with the defaults and click OK. TheODIAsyncStarterWebservice Partner Link appears in your process diagram.
09/07/12 Asynchronously Invoke ODI Scenario from BPEL Process with Callback
25/70oracle.com/webfolder/technetwork/tutorials/obe/fmw/odi/10g/10135/…/odiscenario_bpelcallback.htm
3. From the Components Palette at the right, select Process Activities from the drop-down list, and then drag theInvoke activity onto your process between the receiveInput and callbackClient activities. Drag one of the arrowsfrom the new Invoke activity onto the ODIAsyncStarterWebservice Partner Link.
09/07/12 Asynchronously Invoke ODI Scenario from BPEL Process with Callback
26/70oracle.com/webfolder/technetwork/tutorials/obe/fmw/odi/10g/10135/…/odiscenario_bpelcallback.htm
4. In the Edit Invoke window, name the activity Invoke_ODI. Click the Magic Wand icon next to the Input Variable field.In the Create Variable window, name the variable startOdiPlan_InputVariable. Click OK.
5. Click the Magic Wand icon next to the Output Variable field. In the Create Variable window, name the variablestartOdiPlan_OutputVariable. Click OK. Click OK in the Edit Invoke window. Your process diagram should look asshown below. Save your project.
09/07/12 Asynchronously Invoke ODI Scenario from BPEL Process with Callback
27/70oracle.com/webfolder/technetwork/tutorials/obe/fmw/odi/10g/10135/…/odiscenario_bpelcallback.htm
Back to Topic List
Creating BPEL Preferences to Dynamically Update Process-Level Values
In this section, you create five BPEL preferences (global variables are set at the process level) so that you do not have to recompile the process if you want to change thesevalues. The BPEL process passes the callback information to ODIInvokerService so that it can asynchronously call back at a later time. This information is server-specific.By creating these preferences, you will not need to recompile the process when redeploying to a new server.
To create BPEL preferences to dynamically update process-level values, perform the following steps:
1. In the AsynchODICall.bpel process window, click the Deployment Descriptor Properties icon at the top-left of thediagram. In the window that appears, click Create on the Preferences tab. In the Create Preference dialog box,name the preference retryCount. Click OK.
09/07/12 Asynchronously Invoke ODI Scenario from BPEL Process with Callback
28/70oracle.com/webfolder/technetwork/tutorials/obe/fmw/odi/10g/10135/…/odiscenario_bpelcallback.htm
09/07/12 Asynchronously Invoke ODI Scenario from BPEL Process with Callback
29/70oracle.com/webfolder/technetwork/tutorials/obe/fmw/odi/10g/10135/…/odiscenario_bpelcallback.htm
2. In the Property Value box, enter 1. From the Encryption drop-down list, select Plain Text. Click the Create icon andrepeat the preceding steps for the preferences in the following table. You should have your Deployment DescriptorProperties as shown in the following screenshot. Click OK.
Note: Some of the property values are specific to your environment. The values here are generally correct if youhave performed a basic SOA installation. Check your values.
Property Name Property Value Encryption
java.naming.factory.initial com.evermind.server.rmi.RMIInitialContextFactory Plain Text
java.naming.provider.url opmn:ormi://localhost:6003:home/orabpel Plain Text
OC4JUser oc4jadmin Plain Text
Credentials welcome1Encrypt onserveron deploy
Platform ias_10g Plain Text
09/07/12 Asynchronously Invoke ODI Scenario from BPEL Process with Callback
30/70oracle.com/webfolder/technetwork/tutorials/obe/fmw/odi/10g/10135/…/odiscenario_bpelcallback.htm
Back to Topic List
Assigning the ODIStarterWebservice Input Values
To assign ODIStarterWebservice input values, perform the following steps:
1.From the Components Palette at the right, drag an Assign activity onto the process diagram between the receive_Input and Invoke_ODIactivities.
09/07/12 Asynchronously Invoke ODI Scenario from BPEL Process with Callback
31/70oracle.com/webfolder/technetwork/tutorials/obe/fmw/odi/10g/10135/…/odiscenario_bpelcallback.htm
2.Double-click the new Assign_1 activity. Click the General tab and name the activity Assign_ODIValues. Click the Copy Operation tab andfrom the Create drop-down list, select Copy Operation.
3. In the window that opens, in the From column, expand Process > Variables > inputVariable > payload > ODIProcessRequest > ODI_Info.In the To column, expand Process > Variables > startOdiPlan_InputVariable > parameters > StartOdiPlanElement >OdiInformationDTO_1. Click OK.
09/07/12 Asynchronously Invoke ODI Scenario from BPEL Process with Callback
32/70oracle.com/webfolder/technetwork/tutorials/obe/fmw/odi/10g/10135/…/odiscenario_bpelcallback.htm
4.Now set the preferences from the last section. From the Create drop-down list, select Copy Operation. A new dialog box appears. In theFrom column, from the Type drop-down list, select Expression. Click the Xpath Expression Builder button at the top-right of the Fromcolumn.
09/07/12 Asynchronously Invoke ODI Scenario from BPEL Process with Callback
33/70oracle.com/webfolder/technetwork/tutorials/obe/fmw/odi/10g/10135/…/odiscenario_bpelcallback.htm
09/07/12 Asynchronously Invoke ODI Scenario from BPEL Process with Callback
34/70oracle.com/webfolder/technetwork/tutorials/obe/fmw/odi/10g/10135/…/odiscenario_bpelcallback.htm
5. In the Expression Builder window, under the Functions heading, select BPEL Xpath Extension Functions from the drop-down list. Fromthe updated list, select getPreference and click the Insert Into Expression button. The Expression window now containsora:getPreference(). Change this to ora:getPreference("retryCount"), where retryCount is the name of one of the preferences that youset earlier. Click OK.
6. In the To column, expand Process > Variables > startOdiPlan_InputVariable > parameters > StartOdiPlanElement >CallbackInformationDTO_2 > retryAttempts. Click OK.
09/07/12 Asynchronously Invoke ODI Scenario from BPEL Process with Callback
35/70oracle.com/webfolder/technetwork/tutorials/obe/fmw/odi/10g/10135/…/odiscenario_bpelcallback.htm
7.Repeat the above steps (that created the retryCount copy rule from a preference) to create copy rules for the other preferences. The Fromand To fields are listed in the following table. Your Assign activity with the six copy rules should now match the following screenshot.
From To
ora:getPreference("java.naming.factory.initial") jndiInitialCtxFactory
ora:getPreference("java.naming.provider.url") jndiURL
ora:getPreference("OC4JUser") user
ora:getPreference("Platform") jndiPlatform
09/07/12 Asynchronously Invoke ODI Scenario from BPEL Process with Callback
36/70oracle.com/webfolder/technetwork/tutorials/obe/fmw/odi/10g/10135/…/odiscenario_bpelcallback.htm
You still need to create eight more copy rules. For each row in the following table, create a copy rule, select Expression in the Fromcolumn and enter the corresponding value from the following table. In the To column expand Process > Variables >startOdiPlan_InputVariable > parameters > StartOdiPlanElement > CallbackInformationDTO_2 and select the value that matches thevalue from the table. Your copy operation should now have 14 copy rules inside it and look similar to the following screenshot. Click OK.
From To
string("callback.bpel") callbackHandlerType
string("onODIResult") callbackSuccessOperationName
string("onODIError") callbackErrorOperationName
ora:getProcessURL() SOAPUrl
ora:getDomainId() domainName
ora:getProcessId() processName
ora:getProcessVersion() revision
ora:getConversationId() conversationID
09/07/12 Asynchronously Invoke ODI Scenario from BPEL Process with Callback
37/70oracle.com/webfolder/technetwork/tutorials/obe/fmw/odi/10g/10135/…/odiscenario_bpelcallback.htm
Back to Topic List
Encrypting and Setting the Password for the Callback
ODIInvokerService expects the password to be sent encrypted and hashed with the process conversation ID. You use the Java Embedding activity to encrypt the password.To encrypt and set the password for the callback, perform the following steps:
1.From the Components Palette, drag the Java Embedding activity onto the diagram below the Assign_ODIValues activity. Double-click the newJava_Embedding_1 activity to open it.
09/07/12 Asynchronously Invoke ODI Scenario from BPEL Process with Callback
38/70oracle.com/webfolder/technetwork/tutorials/obe/fmw/odi/10g/10135/…/odiscenario_bpelcallback.htm
2. In the Code Snippet field, cut and paste the code provided below. To save your project, select File > Save All.
/* The following code appends the Credentials preferencewith the instance conversation ID,then encrypts andassigns to the ODIInvokerService input message.*/
String pw = (String)getPreference("Credentials");try {String encryptedPW =com.collaxa.cube.util.CXPasswordUtils.encrypt(pw + "||" + getConversationId());addAuditTrailEntry("Credentials Encrypted");setVariableData ("startOdiPlan_InputVariable","parameters","/ns1:startOdiPlanElement/ns1:CallbackInformationDTO_2/ns1:pw", encryptedPW);} catch(Exception e) {e.printStackTrace();addAuditTrailEntry("Encryption failed: " + e.getMessage());javax.xml.namespace.QName qname = newjavax.xml.namespace.QName("http://bpel.oracle.com/", "EncryptionFailure");throw new com.oracle.bpel.client.BPELFault (qname);}addAuditTrailEntry ("Added encrypted credentials successfully");
09/07/12 Asynchronously Invoke ODI Scenario from BPEL Process with Callback
39/70oracle.com/webfolder/technetwork/tutorials/obe/fmw/odi/10g/10135/…/odiscenario_bpelcallback.htm
Back to Topic List
Receiving the Asynchronous Reply
You use a Pick activity to handle the callback from ODIInvokerService. You need to set handlers for both the response messages, onODIResponse and onODIError, aswell as a timeout activity. To receive the asynchronous reply, perform the following steps:
1. From the Components Palette at the right, drag a Pick activity onto the diagram after the Invoke_ODI activity. Expand the new Pick_1 activity.Click the Add OnMessage Branch icon.
09/07/12 Asynchronously Invoke ODI Scenario from BPEL Process with Callback
40/70oracle.com/webfolder/technetwork/tutorials/obe/fmw/odi/10g/10135/…/odiscenario_bpelcallback.htm
2. Double-click the message branch at the extreme left of the Pick activity. In the window that appears, click the Flashlight icon next to thePartner Link field. Expand Process > Partner Links > client. Click OK.
09/07/12 Asynchronously Invoke ODI Scenario from BPEL Process with Callback
41/70oracle.com/webfolder/technetwork/tutorials/obe/fmw/odi/10g/10135/…/odiscenario_bpelcallback.htm
3. From the Operation drop-down list, select onODIResult. Click the Magic Wand icon next to the Variable field. Name the variableOnMessage_onODIResult and click OK. Click OK in the OnMessage Branch window.
09/07/12 Asynchronously Invoke ODI Scenario from BPEL Process with Callback
42/70oracle.com/webfolder/technetwork/tutorials/obe/fmw/odi/10g/10135/…/odiscenario_bpelcallback.htm
4. Double-click the remaining (right) message branches of the Pick activity. In the window that appears, click the Flashlight icon next to thePartner Link field. Expand Process > Partner Links > client. Click OK.
09/07/12 Asynchronously Invoke ODI Scenario from BPEL Process with Callback
43/70oracle.com/webfolder/technetwork/tutorials/obe/fmw/odi/10g/10135/…/odiscenario_bpelcallback.htm
5. From the Operation drop-down list, select onODIError. Click the Magic Wand icon next to the Variable field. Name the variableOnMessage_onODIError and click OK. Click OK in the OnMessage Branch window.
09/07/12 Asynchronously Invoke ODI Scenario from BPEL Process with Callback
44/70oracle.com/webfolder/technetwork/tutorials/obe/fmw/odi/10g/10135/…/odiscenario_bpelcallback.htm
6. Double-click the onAlarm branch. Change Time from 1 day to 1 hour (or whatever time is appropriate for your load to complete) as shownbelow. Click OK.
09/07/12 Asynchronously Invoke ODI Scenario from BPEL Process with Callback
45/70oracle.com/webfolder/technetwork/tutorials/obe/fmw/odi/10g/10135/…/odiscenario_bpelcallback.htm
7. Expand all three branches. From the Components Palette, drag an Assign activity into all the three branches as shown below.
8. Open Assign_1 in the first (onODIResponse) onMessage branch. Create new copy rules to map the following variables and expressions tothe output variable as shown in the following table (refer to the examples of screenshots below).
09/07/12 Asynchronously Invoke ODI Scenario from BPEL Process with Callback
46/70oracle.com/webfolder/technetwork/tutorials/obe/fmw/odi/10g/10135/…/odiscenario_bpelcallback.htm
From Type From To
Variable
Variable OnMessage_onODIResult> Payload >ODIInvokerServiceResponse >odiPlan
OutputVariable > Payload > ODIProcessResponse> odiPlan
Variable
OnMessage_onODIResult >Payload >ODIInvokerServiceResponse >elapsedTime
OutputVariable > Payload > ODIProcessResponse> elapsedTime
Expression ‘Success’OutputVariable > Payload > ODIProcessResponse> result
Expression ora:getConversationId()OutputVariable > Payload >ODIProcessResponse> ConversationId
09/07/12 Asynchronously Invoke ODI Scenario from BPEL Process with Callback
47/70oracle.com/webfolder/technetwork/tutorials/obe/fmw/odi/10g/10135/…/odiscenario_bpelcallback.htm
09/07/12 Asynchronously Invoke ODI Scenario from BPEL Process with Callback
48/70oracle.com/webfolder/technetwork/tutorials/obe/fmw/odi/10g/10135/…/odiscenario_bpelcallback.htm
9. Click the General tab and name the activity Assign_ODIResponse. Click OK.
10.Double-click to open Assign_2 in the second (onODIError) onMessage branch. Create new copy rules to map the following variables andexpressions to the output variable as shown in the following table. Your Assign_2 activity should look similar to the following screenshot.Click the General tab and name the activity Assign_ODIError. Click OK.
From Type From To
Variable
OnMessage_onODIError >Payload >ODIInvokerServiceFault>odiPlan
OutputVariable > Payload > ODIProcessResponse> odiPlan
Variable
OnMessage_onODIError >Payload >ODIInvokerServiceFault>elapsedTime
OutputVariable > Payload >ODIProcessResponse> elapsedTime
Variable
OnMessage_onODIError >Payload >ODIInvokerServiceFault>errorMessage
OutputVariable > Payload >ODIProcessResponse> result
Expression ora:getConversationId()
OutputVariable > Payload >ODIProcessResponse> ConversationId
09/07/12 Asynchronously Invoke ODI Scenario from BPEL Process with Callback
49/70oracle.com/webfolder/technetwork/tutorials/obe/fmw/odi/10g/10135/…/odiscenario_bpelcallback.htm
11.Open the Assign_3 activity in the third onAlarm branch. Create new copy rules to map the following variables and expressions to the outputvariable as shown in the following table. Your Assign_3 activity should look similar to what is shown below. Click the General tab and namethe activity Assign_TimeOut. Click OK.
From Type From To
Expression 'Timeout waiting for ODI to complete load'OutputVariable > Payload >ODIProcessResponse > result
09/07/12 Asynchronously Invoke ODI Scenario from BPEL Process with Callback
50/70oracle.com/webfolder/technetwork/tutorials/obe/fmw/odi/10g/10135/…/odiscenario_bpelcallback.htm
Expression ora:getConversationId()OutputVariable > Payload >ODIProcessResp onse >ConversationId
Expression
ora:getContentAsString(bpws:getVariableData('inputVariable','payload','/ns2:ODIProcessRequest/ns2:ODI_Info'))
OutputVariable > Payload >ODIProcessResp onse > odiPlan
12.
Verify that your process diagram matches the following image. Click the Validate Process icon at the top of the process diagram torefresh and validate your process. Save your project (File > Save All).
09/07/12 Asynchronously Invoke ODI Scenario from BPEL Process with Callback
51/70oracle.com/webfolder/technetwork/tutorials/obe/fmw/odi/10g/10135/…/odiscenario_bpelcallback.htm
Back to Topic List
Catching Possible Remote Faults
If for some reason ODIInvokerService is not available, you need to catch the error and return a result.
To catch possible remote faults, perform the following steps:
1.On the main process scope, click the Add Catch Branch icon. Scroll to the right and double-click the new Catch Branch icon tothe right of the diagram. Click the Flashlight icon in the Fault Qname section.
09/07/12 Asynchronously Invoke ODI Scenario from BPEL Process with Callback
52/70oracle.com/webfolder/technetwork/tutorials/obe/fmw/odi/10g/10135/…/odiscenario_bpelcallback.htm
09/07/12 Asynchronously Invoke ODI Scenario from BPEL Process with Callback
53/70oracle.com/webfolder/technetwork/tutorials/obe/fmw/odi/10g/10135/…/odiscenario_bpelcallback.htm
2. In the browser, select System Faults > remoteFault. Click OK.
3.Click the Magic Wand icon next to the Fault Variable field to create a new variable. Enter RemoteFaultVar as the variable nameand click OK. Click OK in the Catch Branch window.
09/07/12 Asynchronously Invoke ODI Scenario from BPEL Process with Callback
54/70oracle.com/webfolder/technetwork/tutorials/obe/fmw/odi/10g/10135/…/odiscenario_bpelcallback.htm
4.Expand the Catch activity. From the Components Palette at the right, drag an Invoke activity onto the diagram inside the emptycatch branch. Double-click the new Invoke activity.
09/07/12 Asynchronously Invoke ODI Scenario from BPEL Process with Callback
55/70oracle.com/webfolder/technetwork/tutorials/obe/fmw/odi/10g/10135/…/odiscenario_bpelcallback.htm
5.Name the activity Invoke_Callback. Click the Flashlight icon next to the Partner Link field. Select client and click OK.
09/07/12 Asynchronously Invoke ODI Scenario from BPEL Process with Callback
56/70oracle.com/webfolder/technetwork/tutorials/obe/fmw/odi/10g/10135/…/odiscenario_bpelcallback.htm
6.Click the Magic Wand icon next to the Input Variable field. Name the new variable ErrorOutput. Click OK. Click OK in the Invokeactivity window.
09/07/12 Asynchronously Invoke ODI Scenario from BPEL Process with Callback
57/70oracle.com/webfolder/technetwork/tutorials/obe/fmw/odi/10g/10135/…/odiscenario_bpelcallback.htm
7.From the Components Palette, drag an Assign activity into the Catch branch above the Invoke_Callback activity. Double-click thenew Assign activity to open it. Create new copy rules to map the following variables and expressions to the ErrorOutput variableas shown in the following table.
From Type From To
Variable RemoteFaultVar > summaryErrorOutput > Payload>ODIProcessResponse > result
ErrorOutput > Payload >
09/07/12 Asynchronously Invoke ODI Scenario from BPEL Process with Callback
58/70oracle.com/webfolder/technetwork/tutorials/obe/fmw/odi/10g/10135/…/odiscenario_bpelcallback.htm
Expression ora:getConversationId() ODIProcessResponse>ConversationId
Expressionora:getContentAsString(bpws:getVariableData('inputVariable','payload','/ns2:ODIProcessRequest/ns2:ODI_Info'))
ErrorOutput > Payload >ODIProcessResponse > odiPlan
09/07/12 Asynchronously Invoke ODI Scenario from BPEL Process with Callback
59/70oracle.com/webfolder/technetwork/tutorials/obe/fmw/odi/10g/10135/…/odiscenario_bpelcallback.htm
8.Verify that your Assign activity looks as shown below. Click the General tab and name the activity Assign_CallbackError. ClickOK. Save your project. Your process diagram should now match the following image.
09/07/12 Asynchronously Invoke ODI Scenario from BPEL Process with Callback
60/70oracle.com/webfolder/technetwork/tutorials/obe/fmw/odi/10g/10135/…/odiscenario_bpelcallback.htm
09/07/12 Asynchronously Invoke ODI Scenario from BPEL Process with Callback
61/70oracle.com/webfolder/technetwork/tutorials/obe/fmw/odi/10g/10135/…/odiscenario_bpelcallback.htm
Back to Topic List
Setting Default Input for Invoking the Process
In the following steps, you set default input to test the process from the BPEL Console later on. This prevents you from having to reenter data. To set default input forinvoking the process, perform the following steps:
09/07/12 Asynchronously Invoke ODI Scenario from BPEL Process with Callback
62/70oracle.com/webfolder/technetwork/tutorials/obe/fmw/odi/10g/10135/…/odiscenario_bpelcallback.htm
1. Click the Deployment Descriptor Properties icon at the top of the main diagram. In the window that appears, clickthe Configurations tab.
2. Click the Create icon and select defaultInput from the drop-down list. Click OK.
3. Copy the the XML code provided below and paste it in the Property Value field. Click OK. Save your project.
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <soap:Header/> <soap:Body xmlns:ns1="http://xmlns.oracle.com/ODIService"> <ns1:ODIProcessRequest> <ns1:ODI_Info>
09/07/12 Asynchronously Invoke ODI Scenario from BPEL Process with Callback
63/70oracle.com/webfolder/technetwork/tutorials/obe/fmw/odi/10g/10135/…/odiscenario_bpelcallback.htm
<ns1:odiHostname>localhost</ns1:odiHostname> <ns1:jdbcDriver>oracle.jdbc.driver.OracleDriver</ns1:jdbcDriver> <ns1:logLevel>5</ns1:logLevel> <ns1:sessionNumber>SCEN_IMPORTXFORMEXPORTXML</ns1:sessionNumber> <!-- Include when ODI scenario expects parameters <ns1:odiParameters> <ns1:value></ns1:value> <ns1:name></ns1:name> </ns1:odiParameters> --> <ns1:scenarioName>SCEN_IMPORTXFORMEXPORTXML</ns1:scenarioName> <ns1:jdbcUrl>jdbc:oracle:thin:@localhost:1521:XE</ns1:jdbcUrl> <ns1:scenarioVersion>001</ns1:scenarioVersion> <ns1:jdbcPassword>oracle1</ns1:jdbcPassword> <ns1:workRepositoryCode>WORKREP</ns1:workRepositoryCode><ns1:syncMode>SYNC</ns1:syncMode><ns1:odiHostPort>20910</ns1:odiHostPort> <ns1:context>GLOBAL</ns1:context> <ns1:odiPassword>SUNOPSIS</ns1:odiPassword> <ns1:odiUser>SUPERVISOR</ns1:odiUser> <ns1:jdbcUser>snpm</ns1:jdbcUser> </ns1:ODI_Info> </ns1:ODIProcessRequest> </soap:Body></soap:Envelope>
Note: The above XML contains details to call a specific ODI scenario SCEN_IMPORTXFORMEXPORTXML, whichwas created in the OBE titled Developing an ODI XML Transformation That Can Be Executed Within a BPELProcess, in a specific ODI repository (WORKREP). If you are attempting to invoke your own scenario, make surethat you update the values in the above XML to properly represent the details of the ODI scenario. In this case,update the XML values to invoke your ODI scenario and remove the commented section if you are not passing anyparameters.
Back to Topic List
Deploying Your BPEL Project
To deploy your BPEL process, perform the following steps:
1.From the Application Navigator at the left, expand BPEL2ODIAsync. Right-click your project AsyncODICall and select Deploy >SoademoIntegConnection > Deploy to default domain.
09/07/12 Asynchronously Invoke ODI Scenario from BPEL Process with Callback
64/70oracle.com/webfolder/technetwork/tutorials/obe/fmw/odi/10g/10135/…/odiscenario_bpelcallback.htm
2. In the logging window at the bottom of the page, click the Apache Ant - Log tab. Verify that Build Successful is displayed in green when theprocess has finished deploying.
Note: If you see any errors and/or your process fails to deploy, revisit the above steps to correct the errors.
Back to Topic List
Testing the Process
In the following steps, you invoke the BPEL process from the BPEL console and check to see whether your ODI scenario ran. To test the process, perform the followingsteps:
1.Open a browser and enter http://localhost:8888/BPELConsole as the URL. The Login page appears. Enter your application server credentials: oc4jadmin in the Userfield and welcome1 in the Password field. Click Login. The main BPEL Dashboard appears. Verify that your AsyncODICall BPEL project appears under the DeployedBPEL Processes column on the left.
09/07/12 Asynchronously Invoke ODI Scenario from BPEL Process with Callback
65/70oracle.com/webfolder/technetwork/tutorials/obe/fmw/odi/10g/10135/…/odiscenario_bpelcallback.htm
2.Select your AsyncODICall process in the list of processes at the left. Click the Descriptor tab. On this tab, you can view and set the preferences that you created in theearlier steps. Review and update any of these values if they are not correct.
.
09/07/12 Asynchronously Invoke ODI Scenario from BPEL Process with Callback
66/70oracle.com/webfolder/technetwork/tutorials/obe/fmw/odi/10g/10135/…/odiscenario_bpelcallback.htm
3.Return to the Initiate tab. From the Operation drop-down list, select initiate. Ensure that your ODI agent is running and your ODI scenario is ready to be invoked. Click thePost XML Message button to start the process. When the page refreshes, click the Visual Flow link to view the process execution.
09/07/12 Asynchronously Invoke ODI Scenario from BPEL Process with Callback
67/70oracle.com/webfolder/technetwork/tutorials/obe/fmw/odi/10g/10135/…/odiscenario_bpelcallback.htm
4.Click the Invoke_ODI activity to see the synchronous response from ODIInvokerService and verify that it has received the request successfully. Close the Invoke_ODIactivity window.
09/07/12 Asynchronously Invoke ODI Scenario from BPEL Process with Callback
68/70oracle.com/webfolder/technetwork/tutorials/obe/fmw/odi/10g/10135/…/odiscenario_bpelcallback.htm
5.
Click the Refresh View link . This refreshes the page to receive the asynchronous callback when the load is complete. Open the callbackClient activity tosee the result of the execution. Open ODI Operator and verify that your ODI scenario was invoked and successfully completed.
09/07/12 Asynchronously Invoke ODI Scenario from BPEL Process with Callback
69/70oracle.com/webfolder/technetwork/tutorials/obe/fmw/odi/10g/10135/…/odiscenario_bpelcallback.htm
Back to Topic List
Summary
In this lesson, you learned how to:
Verify the Prerequisites
Create a New Application in JDeveloper and Deploy the ODI Wrapper Service to the Oracle Application Server
09/07/12 Asynchronously Invoke ODI Scenario from BPEL Process with Callback
70/70oracle.com/webfolder/technetwork/tutorials/obe/fmw/odi/10g/10135/…/odiscenario_bpelcallback.htm
Create a New BPEL Process
Update the BPEL Process Interface
Create a Partner Link Representation of the ODIInvokerService
Create BPEL Preferences to Dynamically Update Process-Level Values
Assign the ODIStarterWebservice Input Values
Encrypt and Set the Password for the Callback
Receive the Asynchronous Reply
Catch Possible Remote Faults
Set Default Input for Invoking the Process
Deploy your BPEL Project
Test the Process
Back to Topic List
Place the cursor over this icon to hide all screenshots.