PortX JD Edwards Connector for Mule 4 – Demo – Poll EDI Events

Introduction

The PortX JDE Connector leverages the internal capabilities of Oracle’s JD Edwards EnterpriseOne™ solution to a broader extent, and uses the power of Oracle’s Java Dynamic Connector to provide interoperability with JD Edwards EnterpriseOne™ and external systems.

After reading this guide, you should be able to poll for EDI events created on the EnterpriseOne server

At design time, the PortX JDE Connector allows you to discover functions by name providing full access to all Business Function signatures. Given that discovery is a heavy duty process, the Connector manages a cache repository for all function’s metadata used at least once.

The results of a function call will be injected into the flow as a Map containing key-value pairs with the invocation’s output values. This approach gives the end user freedom of choice to construct complex flows and manage custom exception strategies.

Furthermore, you can have all functions in the flow, processing within the same transaction, and commit or rollback all changes.

Prerequisites

This document assumes that you are familiar with Oracle’s JD Edwards EnterpriseOne™ basics, Mule the Anypoint™ Studio interface.

Requirements

Review the PortX JDE Connector for Mule 4 – Getting Started Guide for a detailed list of requirements and setup prerequisites.

It’s important to read the guide: JD Edwards EnterpriseOne Applications Data Interface for Electronic Data Interchange Implementation Guide

JDE outbound transactions requires that you set a Processing Option specifying the EDI information.

For example, generate an Order Acknowledgment (855/ORDSP) document, it is necessary to setup it’s processing options to enable interoperability. To do this you will need to log into JDE, and change the processing options for this application. Firstly, we need to determine which version of the Print Invoices (R42565) is being used. To do this, we will need to review the processing options.

image

image

The last configuration that is needed is inform to JDE connector the EDI outbound:

Using Flat File Cross-Reference (P47002) form Work With Flat File Cross-Reference adds the following record:

image

Table Record Type Type Description

F47026

1

Header

F47027

2

Detail

F4706

6

Address

F4714

7

Header Text

F4715

8

Detail Text

For more on setting transaction types, please refer to the Oracle JD Edwards EnterpriseOne documentation

Demo – Poll EDI Events

It is recommended that you update AnyPoint Studio before starting with a PortX JDE Connector project.

Creating a new Mule Project

Create a new Mule Project with Mule Server 4.1.1 EE or greater as runtime:

image

Project Dependencies

In you pom.xml, add the following to you repositories section :

<repository>
    <id>portx-repository-releases</id>
    <name>portx-repository-releases</name>
    <url>https://portx.jfrog.io/portx/portx-releases</url>
</repository>

Add the following to you dependencies section :

<dependency>
<groupId>com.modus</groupId>
    <artifactId>mule-jde-connector</artifactId>
    <version>2.0.0</version>
    <classifier>mule-plugin</classifier>
</dependency>
<dependency>
    <groupId>com.jdedwards</groupId>
    <artifactId>jde-lib-bundle</artifactId>
    <version>1.0.0</version>
    <classifier>mule-4</classifier>
</dependency>

Add or update the following to you plugins section :

<plugin>
    <groupId>org.mule.tools.maven</groupId>
    <artifactId>mule-maven-plugin</artifactId>
    <version>$\{mule.maven.plugin.version}</version>
    <extensions>true</extensions>
    <configuration>
        <sharedLibraries>
            <sharedLibrary>
                <groupId>com.jdedwards</groupId>
                <artifactId>jde-lib-bundle</artifactId>
            </sharedLibrary>
        </sharedLibraries>
    </configuration>
</plugin>

Required files

Copy the JD Edwards EntrpriseOne™ configuration files to the following folders within the project:

  • Project Root

  • src/main/resources

If there is a requirement to use different configuration files per environment, you may create separate folders under src/main/resources corresponding to each environment as shown below.

image

The mule-arifact.json file needs to be updated per environment as below

{
	"minMuleVersion": "4.1.4",
	"classLoaderModelLoaderDescriptor": {
		"id": "mule",
		"attributes": {
			"exportedResources": [
				"JDV920/jdeinterop.ini",
				"JDV920/jdbj.ini",
				"JDV920/tnsnames.ora",
				"JPY920/jdeinterop.ini",
				"JPY920/jdbj.ini",
				"JPY920/tnsnames.ora",
				"jdelog.properties",
				"log4j2.xml"
			],
			"exportedPackages": [
				"JDV920",
				"JPY920"
			],
			"includeTestDependencies": "true"
		}
	}
}

Other Considerations

To redirect the JD Edwards EntrpriseOne™ Logger to Mule Logger (allowing you to see the JDE activity in both Console and JDE files defined in the jdelog.properties, you may add the following Async Loggers to log4j2.xml file.

<!-- JDE Connector wire logging -->
<AsyncLogger name="org.mule.modules.jde.handle.MuleHandler" level="INFO" />
<AsyncLogger name="org.mule.modules.jde.JDEConnector" level="INFO" />

Troubleshooting

If you are having trouble resolving all dependencies,

  1. Shut down AnyPoint Studio

  2. Run the following command in the project root folder from the terminal/command prompt,

mvn clean install

  1. Open AnyPoint Studio and check dependencies again.

Configure the Global Element

To use the PortX JDE Connector in your Mule application, you must configure a global element that can be used by the connector (read more about Global Elements).

Open the Mule flow for the project, and select the Global Elements tab at the bottom of the Editor Window.

image

Click Create

image

Type “JDE” in the filter edit box, and select “JDE Config”. Click OK

image

On the General tab, enter the required credential and environment

image

Click Test Connection. You should see the following message appear.

image

You are now ready to start using the PortX JDE Connector in your project

Creating a Scheduler for your flow

NOTE : This use case example will create a simple flow to poll for outbound events coming from an application that uses a *Print Invoices (R42565)* to generate a Order Acknowledgement (855/ORDSP) EDI document, and write these to files (Please check the requirements section earlier in the document for setup details)

Go back to the Message Flow tab

image

From the Mule Palette (typically top right), select Scheduler, and drag it to the canvas

image

Select the Scheduler component from the canvas, and inspect the properties window, and change the Frequency to 2 Minutes

image

Poll for EDI Events

Locate the JDE Connector, and select Edi outbound. Drag this to the canvas.

image

Drag the connector over to the canvas. Select it and review the properties window. Give it a meaningful name eg. Call Poll Order Acknowledgement EDI.

image

Under the General section, click on the drop-down for Operation Name, and select Capture EDI Transactions.

image

Troubleshooting

If the operation fails (possibly due to a timeout), you will see the below message

image

Please review the timeout settings in Anypoint Studio's Preferences.

To do this go the the Window > Preferences menu

image

Go to Anypoint Studio > DataSense and change the DataSense Connection Timeout setting as below

image

Go to Anypoint Studio > Tooling and change the Default Connection Timeout and Default Read Timeout settings as below

image

Setting Parameters

You may now assign the input parameters. You can do this by either entering the payload values manually, or via the “Show Graphical View” button.

image

Drag the inputs to outputs, or double-click the output parameter to add to your edit window, and change as required.

image

Set Payload Output

In the Mule Palette, you can either select Core, scroll down to Transformers or type “Payload” in the search bar.

image

Drag and drop the Set Payload to your canvas.

image

Select the Set Payload component, and review the properties.

image

Change the payload to reflect the desired output, and save the project

image

On the MIME Type tab, select application/xml

image

Next we need to check that Transactions were polled, and exist. From the Mule Palette, Select and drag the Choice component.

image

image

Select the When statement, and review the properties. Enter the below expression to check that transactions exist.

image

We also want to see when the Scheduler returned no transactions, so we will add a logger to the Default condition. From you Mule Palette, drag the logger component to the canvas

image

Select and review the properties, and enter an appropriate message

image

If transactions were retrieved (When condition is true) we need to iterate over all the transactions that have been retrieved. For this we will drag the For Each component from out palette, to our canvas.

image

Select the component, and review the properties.

image

In Collection enter the Transaction Collection as below

image

Now drag the Set Variable component to your canvas, select and review the properties

image

Set the variable name and click on Show Graphical View

image

Set the Variable value to the filename we want to create, and click on Done.

image

From your Mule Palette, drag the X12 EDI > Write component to your canvas.

If you do not have it, you will need to download it from AnyPoint Exchange

image

Review it and create a connector configuration by clicking on the Add button

image

Change schema definitions to inline, click add and enter the required schema (this points to a schema file. You might need to download it if you do not have it)

image

On the Identity Tab, enter the details as required, and click OK

image

Click the Show Graphical View button

image

Enter the Payload as required

%dw 2.0
output application/java
---
{
	Interchange: {
		ISA01: "00",
		ISA03: "00",
		ISA05: "ZZ",
		ISA06: "Modusbox",
		ISA07: "ZZ",
		ISA08: "Customer",
		ISA09: now,
		ISA10: now,
		ISA11: "^",
		ISA12: "00501",
		ISA13: payload.TRANSACTION.COLUMN_EDOC,
		ISA14: "0",
		ISA15: "P",
		ISA16: ">"
	},
	Group: {
        GS01: "PR",
        GS02: "DEMO",
        GS03: "PARTNER",
        GS04: now,
        GS05: now,
        GS06: 1111,
        GS07: "X",
        GS08: "005010"
	},
	SetHeader: {
        ST01: "855",
        ST02: "530006100"
	},
    Heading: {
	    "0200_BAK": {
	            BAK01: "00",
	            BAK02: "AD",
	            BAK03: "PO01",
	            BAK04: now
            		}
	},
	Detail: {
		"0100_PO1_Loop": payload.TRANSACTION.TABLE_2.FORMAT_TABLE_F47027
					map ((FORMAT_TABLE_F47027 , index) ->
						{
                        "0100_PO1": {
                                PO102: FORMAT_TABLE_F47027.COLUMN_UORG as Number,
                                PO103: FORMAT_TABLE_F47027.COLUMN_UOM,
                                PO104: FORMAT_TABLE_F47027.COLUMN_UPRC as Number,
                                PO105: "CP",
                                PO106: "CB",
                                PO107: FORMAT_TABLE_F47027.COLUMN_LITM as String
                        },
                        "0500_PID_Loop": [{
                                "0500_PID": {
                                        PID01: "F",
                                        PID05: FORMAT_TABLE_F47027.COLUMN_DSC1 replace /,/ with ""
                                }
                        }]
                })
        },
        Summary: {
                "0100_CTT_Loop": {
                        "0100_CTT": {
                                CTT01: sizeOf(payload.TRANSACTION.TABLE_2.FORMAT_TABLE_F47027) ,
                                CTT02: 1
                        }
                }
        }
}

From your Mule Palette, Select the File > Write component, and drag it to the canvas

image

image

Select and review the Properties. Under the Basic Settings, Click the Add button next to Connector configuration.

image

In the Working Directory field, enter the path where you want to write the file to, and click OK.

image

Under the General section, click the Switch to expression button, and enter the variable name.

image

Testing the Mule Flow

To Test your flow, you need to start the Mule application. Go to the Run menu, and select Run.

image

After the project has been deployed, you can test you flow by logging into JDE. Go to the Customer Master Information Application (P03013 ZJDE0002)

This needs to be a version that has been configured for interoperability (see the Requirements section of this document)

image

Make a change to the customer, and check your output path for a created file.

image

The Transaction XML has been write to the file.

image

Handling exceptions

From your Mule Pallete, select and drag the Error Handler to your canvas

image

image

Now select and drag the On Error Continue into the Error Handler

image

Select the On Error Continue scope, and under Type enter JDE:ERROR_PROCESSING_POLL_EVENT

image

NOTE : The operation error types can be seen when selecting the operation on your canvas, going to Error Mapping, and clicking add. You may also map this error to a aplication specific error.

image

Drag the Set Payload component to the Error Handler, and set an appropriate message

image

PortX JDE Connector – Demo Projects

Additional Demos

There are additional demo applications with step by step guides available for download. These cover all the basic operations, and are