5 Create a Fraud Detection Application with EDN Adapters

This chapter walks through the steps to create and deploy a fraud detection application to present two major new features in the Oracle Stream Analytics 12c release. The first feature is support for the entire Oracle Stream Analytics application life cycle with Oracle JDeveloper. The second feature is Event Delivery Network (EDN) adapter support so that an Oracle Stream Analytics application can send events to and receive events from Oracle SOA Suite. You create and deploy the Oracle Stream Analytics fraud detection application entirely in Oracle JDeveloper.

This chapter covers the following topics:

5.1 Fraud Detection Scenario

In this walkthrough, you create an Oracle Stream Analytics application that implements a real-time analysis of customer orders. An email address uniquely identifies each customer. While order data (event data) passes to the Oracle Stream Analytics server, an Oracle Stream Analytics application dynamically accesses the data and checks for potential fraudulent activity. In this example, event patterns with an aggregated dollar amount for orders by the same person that exceeds $1000 in any 24 hour period indicate possible fraudulent activity.

You can use this fraud detection example application as a base for future real-time fraud detection event-based solutions. Once deployed, the Oracle Stream Analytics EDN application listens for events coming from the Oracle SOA suite event network.

5.2 Before You Begin

This walkthrough assumes that you have Oracle SOA Suite and Oracle Stream Analytics installed. In this walkthrough, the top-level installation directory is referred to as /Oracle/Middleware/, the Oracle SOA Suite installation directory is referred to as /Oracle/Middleware/my_soa, and the Oracle Stream Analytics installation directory is referred to as /Oracle/Middleware/my_oep.

You should also have your JAVA_HOME variable set to point to JDK7_u55 or above, and the PATH variable set to point to the bin directory under your JDK installation:

export JAVA_HOME=<path to installation directory>
export PATH=${JAVA_HOME}/bin:${PATH}

Note:

Although this walkthrough introduces features specific to Oracle Stream Analytics, it assumes that you are familiar with basic Java programming.

5.3 Event Delivery Network Walkthrough

The following list outlines the high-level tasks required to develop and deploy the Oracle Stream Analytics fraud detection application:

5.3.1 Start Oracle WebLogic Server

To perform the steps in the walkthrough, start Oracle JDeveloper and Oracle WebLogic Server. Oracle JDeveloper and Oracle WebLogic Server are part of Oracle SOA Suite.

You start the Oracle Stream Analytics server at a later step in the walkthrough.

Start Oracle JDeveloper and Oracle WebLogicServer

  1. In your work area, navigate to /Oracle/Middleware/soa/jdeveloper/jdev/bin.
  2. Start Oracle JDeveloper by typing ./jdev -clean at the command line.

    The Oracle JDeveloper initial screen displays.

  3. In Oracle JDeveloper, select Run > Start Server Instance.
  4. If a Create Default Domain dialog displays, accept the defaults and enter and confirm a domain password that is at least 7 characters long with at least one numeric character. For example, welcome1.

    Oracle WebLogic Server prints messages in the message area while it takes a few minutes to come up. The server is up and running when you see the message: SOA Platform is running and accepting requests and a red box below the menu bar and next to the search field at the top of the menu area.

5.3.2 Copy the Artifacts Folder

The OEP_Fraud_Detection_Walkthrough_Files.zip file provides supporting files that you need for this walkthrough. The folder contains the event definition files (*.edl and *.xsd), the sample fraud detection Oracle CQL code, and a sample SOA Composite (EDNOEPv2). A SOA composite is a SOA application that interfaces between Oracle SOA Suite and the EDN.

Note that the EDL and schema (xsd) files have to be in the fixed path of the bundled JAR file

Get the Artifacts Folder

  1. Go to http://www.oracle.com/technetwork/middleware/complex-event-processing/overview/complex-event-processing-088095.html.
  2. Locate the OEP_Fraud_Detection_Walkthrough_Files.zip file and download it to an accessible location on your computer.
  3. Unzip the zip file.

5.3.3 Create an Oracle Stream Analytics Domain

In this step, you use the config.sh command to start the Configuration wizard and create a new domain for the Fraud Check application to use.

Create a New Domain

  1. Navigate to your Oracle Stream Analytics installation to the /Oracle/Middleware/my_oep/oep/common/bin directory.

  2. In the /Oracle/Middleware/my_oep/oep/common/bin directory, type ./config.sh to start the Configuration wizard.

    The Configuration wizard Welcome screen displays.

  3. On the Welcome screen, click Next.

    The Choose Create or Update Domain screen displays.

  4. On the Choose Create or Update Domain screen, select Create a new OEP domain and click Next.

    The Create or Update Domain screen displays.

  5. In the Create or Update Domain screen, in the User Name field, enter oepadmin, and enter and confirm the password, welcome1.

  6. Click Next.

    The Configure Server screen displays.

  7. In the Configure Server screen, click Next to accept the defaults.

    The Configure Domain Identity Keystore screen displays.

  8. In the Configure Domain Identity Keystore screen, enter and confirm the password welcome1 and click Next.

    The Configuration Options screen displays.

  9. In the Configuration Options screen, click Next to not perform any optional configuration.

    The Create OEP Domain screen displays.

  10. In the Create OEP Domain screen, enter fraudcheck_domain and make a note of its location.

    The location will be something like /Oracle/Middleware/my_oep/user_projects/domains.

  11. Click Create, and after a few moments, click Done.

Add the EDNConnectionFactory to the Domain

  1. Navigate to /Oracle/Middleware/my_oep/user_projects/domains/fraudcheck_domain/defaultserver and open the fraudcheck_domain startwlevs.sh file with a text editor.
  2. Add the following system properties to the JAVA_HOME command line at the bottom of the file.

    The system properties go before the -jar $USER_INSTALL_DIR setting.

    -Dedn.jms.topic="jms/fabric/EDNTopic" -Dedn.jms.connection-factory="jms/fabric/EDNConnectionFactory"
    

    The final JAVA_HOME line in startwlevs.sh looks like this: (all on one line):

    "$JAVA_HOME/bin/java" $JVM_ARGS $JVM_D64 $DEBUG_ARGS
      -Dwlevs.home="$USER_INSTALL_DIR" 
      -Dedn.jms.topic="jms/fabric/EDNTopic"
      -Dedn.jms.connection-factory="jms/fabric/EDNConnectionFactory" 
      -jar "${USER_INSTALL_DIR}/bin/wlevs.jar" $ARGS
    

    The system properties instruct the Oracle Stream Analytics server to use the JMS implementation for the EDN rather than the default, which is Advanced Queuing (AQ).

5.3.4 Create a Java Message Service Topic

A Java Message Service (JMS) topic is a mechanism for publishing messages to one or more subscribers. Use the Oracle WebLogic Server administration console to create a JMS topic.

Create a JMS Topic

  1. In your work area, open a browser.

    The browser displays.

  2. In the browser URL box, type localhost:7101/console in the URL box.

    The administration console login screen displays.

  3. Log in to the administration console with a user name of weblogic and the password welcome1.

    The WebLogic Server Administration Console screen displays.

  4. In the left panel, under Domain Structure, expand Services > Messaging > JMS Modules.
  5. In the right panel under JMS Modules, click SOAJMSModule.

    The Settings for SOAJMSModule screen displays.

  6. In the right panel, under Summary of Resources, click New.

    The Create a New JMS System Module Resource screen displays.

  7. In the Create a New JMS System Module Resource screen, select the Topic radio button and click Next.

    The Create a New JMS System Module - JMS Destination Properties screen displays.

  8. In the JMS Destination Properties in the Name field, enter EDNTopic, and in the JNDI Name field, enter jms/fabric/EDNTopic.
  9. Click Next.

    The next Create a New JMS System Module screen displays.

  10. In the Create a New JMS System Module screen, in the Subdeployments drop-down list, select SOASubDeployment and make sure the SOAJMSServer radio button is checked.
  11. Click Finish.

    The EDNTopic JMS topic displays in the Summary of Resources table.

    In the following figure, EDNTopic, displays in the third row of the table underneath EDNConnectionFactory. The EDNConnectionFactory is part of the Oracle WebLogic Server installation. Connection factories are objects that enable JMS clients to create concurrent JMS connections. The EDNConnectionFactory object enables the JMS EDNTopic to create an EDN connection to Oracle SOA Suite.

5.3.5 Start the Oracle Stream Analytics Server

Start the Oracle Stream Analytics server so that you can create and deploy the Oracle Stream Analytics Fraud Detection application.

Start the Oracle Stream Analytics Server

  1. Go to /Oracle/Middleware/my_oep/user_projects/domains/fraudcheck/ domain/defaultserver.

  2. Execute the appropriate startup script:

    1. On Windows:

      • prompt> startwlevs.cmd
        
    2. On UNIX:

      • prompt> ./startwlevs.sh
        

    The terminal window displays messages as the server starts. When you see, <The application context for "com.bea.wlevs.dataservices" was started successfully >, the Oracle Stream Analytics server is ready.

5.3.6 Use Oracle JDeveloper to Create An Oracle Stream Analytics Application

Start Oracle JDeveloper

If Oracle JDeveloper is not already running, start it.

  1. Go to /Oracle/Middleware/my_soa/jdeveloper/jdev/bin.

  2. Type ./jdev -clean.

    The Select Role dialog displays.

  3. In the Select Role dialog, select Studio Developer (All Features) and click OK.

    Wait a few moments while Oracle JDeveloper starts.

Create a New Application

  1. Select File > New > Application.

    The New Gallery dialog displays.

  2. In the New Gallery dialog, select OEP Application and click OK.

    The Create OEP Application screen displays.

  3. In the Create OEP Application dialog, enter the following values:

    Application Name: FraudOEPApplication Directory: Accept the default Application Package Prefix: Leave blank

  4. Click Next.

    The Create OEP Application - Step 2 screen displays.

  5. In the Create OEP Application - Step 2 dialog, enter the following values:

    Project Name: FraudCheck Directory: Accept the default Project Features: OEP Suite

  6. Click Next.

    The Create OEP Application - Step 3 dialog displays.

  7. In the Create OEP Application - Step 3 dialog, click Next to accept the defaults.

    The Create OEP Application - Step 4 dialog displays.

  8. In the Create OEP Application - Step 4 dialog, Click Finish to accept the defaults:

    The Empty OEP Project template provides the basic structure of an Oracle Stream Analytics application, which are an empty configuration file and assembly files.

    The OEP Server Connections can be left blank at this stage. In a later step, you create the Oracle Stream Analytics server connection.

  9. Click Finish.

    The Oracle Stream Analytics FraudCheck project displays.

  10. If you cannot see the empty EPN Diagram tab and the components panel, go to the Applications panel, expand FraudCheck > OEP Content and double-click EPN Diagram.

Add an Inbound Adapter Stage

  1. With the EPN diagram open, go to the right panel under Components, and open the EDN Adapter window

    The EDN inbound and outbound adapters display.

  2. Drag the EDN Inbound Adapter component from the EDN Adapter window to the empty middle panel (canvas).

    The New EDN Adapter wizard starts.

  3. In the New EDN Adapter wizard, provide the following values:

    Adapter ID: edn-inbound-adapter. File name: adapter.xml.

    Changing the file name from processor.xml to a name that is specific to your usage, distinguishes the files you create from the default files provided by Oracle JDeveloper.

  4. Click Next.

  5. In the EDN Inbound Adapter Configuration dialog, specify the following values that relate to your Oracle WebLogic Server configuration.

    JNDI Provider URL: t3://localhost:7101. JNDI Factory: weblogic.jndi.WLInitialContextFactory. User: weblogic. Password: welcome1.

    WebLogic T3 clients are Java RMI clients that use the Oracle T3 protocol to communicate with Oracle WebLogic Server. T3 clients typically outperform other client types.

  6. Under Edl Properties, load the Edl File as follows:

    1. Click the search icon (magnifying glass) next to the EDL File field.

    2. Navigate to the location where you unzipped the OEP_Fraud_Detection_Walkthrough_Files.zip file.

    3. Select the FraudCheckEvent.edl file inside the folder and click OK.

  7. Under Edl Properties, select FraudCheckRequest from the Event Type drop-down list.

  8. In the EDN Inbound Adapter Configuration dialog, under Advanced Properties, select the schema file associated with the FraudCheckEvent.edl file as follows:

    1. Click the search icon (magnifying glass) next to the Schema File field.

    2. Navigate to the location where you unzipped the OEP_Fraud_Detection_Walkthrough_Files.zip file.

    3. Select the FraudCheckType.xsd file inside the folder and click OK.

  9. Click Finish.

    Two informational dialogs display about the files you are uploading.

  10. Read the informational message and press OK to dismiss them.

    The EDN diagram displays the edn-inbound-adapter that you just created, and the Fraud Check project lists the files that you uploaded.

  11. Select File > Save to save your work.

Add an Input Channel Stagestage

  1. In the right panel under Components, open the Base EPN Components window.

    The base EPN components display.

  2. Drag the Channel component to a free space on the canvas.

    The New Channel dialog displays.

  3. In the New Channel dialog, provide the following information:

    Channel ID: ednInputChannel. Event Type: <NONE>

  4. Click OK.

    The EDN diagram displays the channel that you just created.

  5. Select File > Save to save your work.

Connect the Input Channel and Inbound Adapter Components

  1. Select and hold edn-inbound-adapter with the left mouse button.

  2. Drag the edn-inbound-adapter to the ednInputChannel.

    After a few moments, a line displays to connect the adapter to the channel. The components adjust so that the adapter and channel are in a line going left to right with the channel to the left of the adapter. This alignment depicts the flow of information into and out of the EDN from left to right.

  3. Select File > Save to save your work.

Set properties on the edn-inbound-adapter

  1. Select the ednInputChannel event stage.

    Oracle JDeveloper highlights the ednInputChannel.

  2. In the Properties window in the bottom-right corner of Oracle JDeveloper, select edl:FraudCheckRequest from the event-type drop-down list.

    The FraudCheckRequest event type is now associated with the ednInputChannel. This means that the Fraud Check application checks for FraudCheckRequest events as events come through the ednInputChannel.

  3. Select File > Save to save your work.

Add an EPN Oracle CQL processor Stage

  1. Under Base EPN Components, drag the Processor component to a free space on the canvas.

    The New Processor dialog displays.

  2. In the New Processor dialog, provide the following information:

    Processor ID: ednProcessor. File name: processor.xml.

  3. Click OK.

    The EDN diagram displays the ednprocessor that you just created.

  4. Select File > Save to save your work.

Add CQL code to the Processor

  1. Right-click the ednProcessor stage.

    The context menu displays.

  2. From the context menu, select Go To Configuration Source.

    Oracle JDeveloper opens a source editor where you place the Oracle CQL rules to be applied to the streaming event data. The source editor provides a sample query that you can edit or replace.

  3. Replace the sample Oracle CQL with the Oracle CQL provided in the ProcessorCQLFraudSample.xml file that is inside your OEP_Fraud_Detection_Walkthrough_Files folder.

    You replace the sample Oracle CQL including <rules>..</rules> with the following Oracle CQL code:

    <rules>
      <view id="FraudView"><![CDATA[
        select S.properties as properties,
          cast@java(S.javaContent,
          com.oracle.oep.FraudCheckRequest.class).getOrderNumber() as orderNumber,
          cast@java(S.javaContent,
          com.oracle.oep.FraudCheckRequest.class).getEmail() as email,
          cast@java(S.javaContent,
          com.oracle.oep.FraudCheckRequest.class).getTotalAmount() as totalAmount
        from ednInputChannel as S
      ]]></view>
    
    <!--
    With id=FraudViewAmountOk, the view and query statements detect the case where the sum of all order amounts from a specific email over a 24 hour period is less than $1000. In this case, he query issues a FraudCheckResponseEvent with status OK.
    -->
    
      <view id="FraudViewAmountOk"><![CDATA[
        select email
        from FraudView[range 24 hours]
        group by FraudView.email
        having sum(FraudView.totalAmount) <= 1000.0
       ]]></view>
    
       <query id="FraudQueryAmountOk"><![CDATA[
         select V1.properties as properties,
         FraudCheckResponse(V1.orderNumber, "OK")
         as javaContent
         from FraudView[partition by email rows 1] as V1, FraudViewAmountOk as V2
         where V1.email = V2.email
       ]]></query>
    
    <!--
    With id= FraudViewAmountAlert, the view and query statements detect the case where the sum of all order amounts from a specific email over a 24 hour period is greater than $1000. In this case, the query issues a FraudCheckResponseEvent with status THRESHOLD_EXCEEDED.
    -->
    
      <view id="FraudViewAmountAlert"><![CDATA[
        select email
        from FraudView[range 24 hours]
        group by FraudView.email
        having sum(FraudView.totalAmount) > 1000.0
      ]]></view>
    
      <query id="FraudQueryAmountAlert"><![CDATA[
         select V1.properties as properties,
         FraudCheckResponse(V1.orderNumber, "THRESHOLD_EXCEEDED")
         as javaContent
         from FraudView[partition by email rows 1] as V1, FraudViewAmountAlert 
         as V2 where V1.email = V2.email
      ]]></query>
    </rules>
    
  4. Select File > Save to save your work.

  5. Click the EPN Diagram tab to return to the EPN diagram.

Connect the Input Channel and the Oracle CQL processor

  1. Select and hold ednInputChannel with the left mouse button.

    Oracle JDeveloper highlights the ednInputChannel.

  2. Drag ednInputChannel to the ednProcessor.

    After a few moments, a line displays to connect the input channel to the Oracle CQL processor. The components adjust so that the adapter, channel, and Oracle CQL processor are in a line going left to right.

  3. Select File > Save to save your work.

Add an Outbound Channel Stage

  1. Under Base EPN Components, drag the Channel component to a free space on the canvas.

    The New Channel dialog displays.

  2. In the New Channel dialog, provide the following information:

    Channel ID: ednOutputChannel. Event Type: <NONE>

  3. Click OK.

    The EDN diagram displays the channel that you just created.

  4. Select File > Save to save your work.

Set properties on the Outbound Channel

  1. Select ednOutputChannel.

    Oracle JDeveloper highlights the ednOutputChannel.

  2. In the Properties window in the bottom-right corner of Oracle JDeveloper, select edl:FraudCheckResponse from the event-type drop-down list.

  3. Select File > Save to save your work.

Connect the Processor and the Outbound Channel

  1. Select and hold ednProcessor with the left mouse button.

    Oracle JDeveloper highlights the ednProcessor.

  2. Drag ednProcessor to ednOutputChannel.

    After a few moments, a line displays to connect the Oracle CQL processor to the output channel. The components adjust so that the adapter, channel, and Oracle CQL processor are in a line going left to right.

  3. Select File > Save to save your work.

Add an Outbound Adapter Stage

  1. Under EDN Adapters, drag the EPN Outbound Adapter component from the EDN Adapter window to the canvas.

    The New EDN Adapter wizard starts.

  2. In the New EDN Adapter wizard, provide the following values:

    Adapter ID: edn-outbound-adapter. File name: adapter.xml.

  3. Click Next.

    The EDN Outbound Adapter Configuration dialog displays.

  4. In the EDN Outbound Adapter Configuration dialog, specify the following values that relate to your Oracle WebLogic Server configuration.

    JNDI Provider URL: t3://localhost:7101. JNDI Factory: weblogic.jndi.WLInitialContextFactory. User: weblogic. Password: welcome1.

  5. In the EDN Outbound Adapter Configuration dialog, under Edl Properties, load the Edl File as follows:

    1. Click the search icon (magnifying glass) next to the EDL File field.

    2. Navigate to the location where you unzipped the OEP_Fraud_Detection_Walkthrough_Files.zip file.

      Because you already loaded this file, you can also locate it under $HOME/jdeveloper/mywork/Application1/FraudCheck/META-INF/wlevs/edn.

    3. Select the FraudCheckEvent.edl file inside the folder and click OK.

      When you load the FraudCheckEvent.edl file, the Event Type drop-down list is populated with events to use in the Fraud Check application.

  6. In the EDN Outbound Adapter Configuration dialog, in the Event Type drop-down list, select FraudCheckResponse.

  7. Click Finish.

    The EDN diagram displays the edn-inbound-adapter that you just created, and the Fraud Check project lists the files that you uploaded.

  8. Select File > Save to save your work.

Connect the Outbound Channel and the Outbound Adapter

  1. Select and hold ednOutputChannel with the left mouse button.

    Oracle JDeveloper highlights the ednOutputChannel.

  2. Drag ednOutputChannel to edn-Outbound-adapter.

    After a few moments, a line displays to connect the output channel to the output adapter. The components adjust so that the adapter, channel, and Oracle CQL processor are in a line going left to right.

  3. Select File > Save to save your work.

5.3.7 Deploy the Application with JDeveloper

Application deployment involves creating a server connection and a deployment profile.

Create an Oracle Stream Analytics Server Connection

  1. In Oracle JDeveloper, select File > New > From Gallery.

    The New Gallery dialog displays.

  2. In the New Gallery dialog under Categories, select Connections.

  3. In the New Gallery dialog under Items, select OEP Connection, and click OK.

    The Create OEP Server Connection dialog displays.

  4. In the Create OEP Server Connection dialog, provide the following information:

    Connection will be created in: IDE Connections: Checked OEP Server Connection Name: FraudDetectionConnection. OEP Server Home Path: /Oracle/Middleware/my_oep/ Use Default Values: Unchecked. OEP Server Projects Directory: user_projects/domains/ fraudcheck_domain/defaultserver. Use Default Values: Checked. Host: 127.0.0.1. Port: 9002. Use Default Values: Unchecked. Username: oepadmin. User Password: welcome1. Additional Parameters for OEP Server: blank.

  5. In the Create OEP Server Connection dialog, click Test Connection.

    If you see Success in the area below the Test Connection button, you entered the information correctly. If you see errors, correct them and test again until you see Success.

  6. In the Create OEP Server Connection dialog, when you see the Success message, click OK.

    FraudDetectionConnection displays under Application Resources > Connections > OEP Server Connection in the left panel.

Create a Deployment Profile

A deployment profile creates an OSGi bundle that contains the required library JAR file.

  1. Right-click the FraudCheck project and select Deploy > New Deployment Profile.

    The Create Deployment Profile dialog displays.

  2. In the Create Deployment Profile dialog, provide the following values.

    Profile Type: OEP Project Deployment Profile.

    Note:

    Make sure you select the correct Profile Type, OEP Project Deployment Profile.

    Deployment Profile Name: oep-profile-Production

  3. Click OK.

    The Deployment Properties dialog displays.

  4. In the Deployment Properties dialog, edit the information so that it is correct:

    Connection to Local OEP Server: FraudDetectionConnection (127.0.0.1:9002) Symbolic Name: FraudOEPApplication.FraudCheck Bundle Name: FraudOepApplication.FraudCheck Bundle Version: 1.0.0 OSGi JAR file: Application1/FraudCheck/deploy/oep_profile-production.jar

  5. Click OK.

Deploy the Application

  1. Right-click the FraudCheck project.

    The context menu displays.

  2. In the context menu, select Deploy > oep_profile-Production.

    The Deploy oep_profile-Production dialog displays.

  3. In the Deploy oep_profile-Production dialog, select Deploy OSGi bundle to target platform.
  4. Click Next.

    The Deploy oep_profile-Production Summary dialog displays.

  5. In the next Deploy oep_profile-Production Summary dialog, confirm the information.
  6. Click Finish.

    In the Deployment - Log window at the bottom of the middle panel, messages indicate the successful deployment. Your Oracle Stream Analytics Application is running and waiting for EDN events to arrive for processing.

    In the left panel under Application Resources, you can see the FraudOEPApplication.FraudCheck [Running] connection displays under Connections > OEP Server Connection > OEPConnection > Applications.

    The terminal window where you started the Oracle Stream Analytics window. INFO: Subscribe Event from Topic=jms/fabric/EDNTopic, JmsType=WLJMS, isXA=false.

5.3.8 Create and Deploy the Sample SOA Composite

A sample SOA composite provides FraudCheckRequest events so that the application can check for potential fraudulent activities. How to create the sample composite is not fully described, but it does provide a good code sample for you to leverage in existing or new SOA composites.

The EDNOEPv2Proj SOA composite is provided in the OEP_Fraud_Detection_Walkthrough_Files.zip file. The SOA composite sends EDN events to the Oracle Stream Analytics application and the resulting EDN events are sent back to the SOA composite. The SOA composite then uses the JCA File adapter to write the information to a file that is saved for you to review and analyze later.

Access the Provided SOA Composite

  1. In Oracle JDeveloper, select File > Open.

    The Open dialog displays.

  2. In the Open dialog, navigate to where you unzipped the OEP_Fraud_Detection_Walkthrough_Files.zip file.

  3. Open the EDNOEPv2 folder and select EDNOEPv2.jws project.

  4. Click Open.

    Oracle JDeveloper adds the SOA composite to the FraudCheck project.

View and Deploy the SOA Mediators

  1. Navigate to Projects > EDNOEPv2Proj > SOA > Mediators and view the mediators.

  2. Right-click the EDNEOPv2Proj project.

    The context menu displays.

  3. In the context menu, select Deploy > New Deployment Profile.

    The Create Deployment Profile dialog displays.

  4. In the Create Deployment Profile dialog under Profile Type, select SOA-SAR File.

  5. In the Ceate Deployment Profile dialog in the Deployment Profile Name field, enter sar_OEP_TEST_COMPOSITE.

  6. Click OK.

    The SAR Deployment Properties dialog displays.

  7. In the SAR Deployment Profile Properties dialog, click OK.

  8. Right-click the EDNEOPv2Proj project.

    The context menu displays.

  9. In the context menu, select Deploy > sar_OEP_TEST_COMPOSITE

    The Deployment Action dialog displays.

  10. In the Deployment Action dialog, select Deploy to Application Server.

  11. Click Next.

    The Deploy Configuration dialog displays.

  12. In the Deploy Configuration dialog, check the Overwrite any existing composites with the same revision ID check box.

    Keep the default values.

  13. Click Next.

    The Select Server dialog displays.

  14. In the Select Server dialog, select IntegratedWebLogicServer and click Next.

    The SOA Servers dialog displays.

  15. In the SOA Servers dialog, click Next to keep the default values.

    The Summary dialog displays.

  16. In the Summary dialog, review the settings for accuracy, and click Finish.

    When the modified SOA composite successfully deploys, it creates a default JMS mapping for the FraudCheckRequest and FraudCheckResponse event types. It is likely that this JMS mapping uses AQ, instead of WLS JMS. To interoperate with this Oracle Stream Analytics application, the JMS mapping for these specific event types needs to be changed to use WLS JMS. The mapping change is done with Oracle Enterprise Manager, which is part of Oracle SOA Suite.

Use Oracle Enterprise Manager to Verify the JMS Mapping

  1. Open a browser, and enter localhost:7101/em into the URL box.

  2. Log in with the user name weblogic and the password welcome1.

  3. In the left panel, expand SOA > soa-infra (Default Server) > default > EDNOEPv2Proj.

  4. Right-click soa-infra (Default Server) and select Business Events from the context menu.

    The Business Events screen displays in the right panel.

  5. On the Business Events screen, select the Events tab.

    The Namespaces and Events table displays FraudCheckRequest and FraudCheckResponse with a Default link in the JMS Mapping column.

  6. In the Events tab, select the Default link.

    The JMS Mapping dialog displays.

  7. In the JMS Mapping dialog, verify the following information and make changes as needed.

    Oracle Enterprise Messaging System(OEMS): Oracle Weblogic JMS JNDI Connection Factory (XA, Durable): eis/wls/EDNxaDurableTopic JNDI Connection Factory (XA, Non-Durable): eis/wls/EDNxaTopic JNDI Connection Factory (Non-XA, Durable): eis/wls/EDNLocalTxDurableTopic JNDI Connection Factory (Non-XA, Non-Durable): eis/wls/EDNLocalTxTopicJMS Topic Name: jms/fabric/EDNTopic

  8. Press Apply.

    The JMS Mapping value changes to Modified.

  9. Repeat for the second Default link.

Update the Sample SOA Composite for Results Analysis

  1. In Oracle JDeveloper, under EDNOEPv2Proj > SOA, double-click EDNOEPv2Proj to display the diagram.

  2. On the diagram, double-click the EDNToFileOutput component.

    The File Adapter Configuration Wizard displays.

  3. In the File Adapter Configuration Wizard, step through the dialogs accepting the provided values until you get to the File Configuration dialog.

    The File Configuration dialog displays.

  4. In the File Configuration dialog, change the Directory for Outgoing Files (physical path) to a location that is valid in your environment.

  5. Write the new location down because you will use it later to review and analyze the response information.

  6. Click Next and complete the remaining steps by accepting the default values.

  7. Click Finish.

Redeploy the SOA Composite

  1. Right-click the EDNEOPv2Proj project.

    The context menu displays.

  2. From the context menu, select Deploy > sar_OEP_TEST_COMPOSITE

    The Deployment Action dialog displays.

  3. In the Deployment Action dialog, select Deploy to Application Server.
  4. Click Next.

    The Deploy Configuration dialog displays.

  5. In the Deploy Configuration dialog, check the Overwrite any existing composites with the same revision ID check box and keep the default values.
  6. Click Next.

    The Select Server dialog displays.

  7. In the Select Server dialog, select IntegratedWebLogicServer and click Next.

    The SOA Servers dialog displays.

  8. In the SOA Servers dialog, click Next to keep the default values.

    The Summary dialog displays.

  9. In the Summary dialog, review the settings for accuracy, and click Finish.

    When the modified SOA composite successfully deploys, it creates a default JMS mapping for the FraudCheckRequest and FraudCheckResponse event types. It is likely that this JMS mapping uses AQ, instead of WLS JMS. To interoperate with this Oracle Stream Analytics application, the JMS mapping for these specific event types needs to be changed to use WLS JMS. The event types change is done with Oracle Enterprise Manager, which is part of Oracle SOA Suite

5.3.9 Test the Fraud Detection Application

Use Oracle Enterprise Manager to test the SOA Composite and its interaction and integration with the new Oracle Stream Analytics Application.

Log in to Enterprise Manager and navigate to the Test Web Service Screen

  1. Open a browser, and enter localhost:7101/em into the URL box.

    The Enterprise Manager login screen displays.

  2. Log in to Enterprise Manager with the user name weblogic and the password welcome1.

    The SOA Infrastructure screen displays.

  3. In the SOA Infrastructure screen left panel under Target Navigation, expand SOA > soa-infra (Default Server) > default and select EDNOEPv2Proj.

  4. In the SOA Infrastructure right panel, press the Test button.

Test the SOA Composite and the Oracle Stream Analytics Application

  1. On the Test Web Service screen, scroll down in the right panel until you see the Input Arguments section.
  2. In the Input Arguments section under SOAP Body, notice that there are two fields, email and amount.

    The email and amount fields let you enter an email address and an amount to be passed to the Oracle Stream Analytics application. The email address is used by the Oracle CQL Group By clause to identify each collection of related orders and the dollar amount value.

  3. In the email field, enter an email address, and in the amount field, enter 200.00.
  4. Scroll to the top of the page and click Test Web Service.

    Check the terminal window where you started Oracle WebLogic server. You see a message like the following that lets you know that a FraudCheckEvent has been published to the file:

    INFO: Publishing Event "{http://xmlns.oracle.com/Application2/Project1/FraudCheckEvent}FraudCheckResponse" to Topic="jms/fabric/EDNTopic", JmsType=WLJMS, isXA=false
    
  5. With the same email address, enter more amounts and click Test Web Service until you have submitted more than $1000 worth of events.
  6. With a text editor, navigate to the directory for the oepToedn-output_PRODUCTION.txt file and open it.

    For the created order number, the record status is THRESHOLD EXCEEDED. This status was determined by the Oracle CQL statements in the Oracle Stream Analytics Application.