X

The Integration blog covers the latest in product updates, best practices, customer stories, and more.

Inbound EDI message to Oracle Integration for B2B World

In this blog, let's create a basic inbound integration flow that receives an EDI document through a REST request, parses and validates the EDI, converts it to XML, and returns the XML in the response.

We shall use REST adapter to keep our blog simple but, you can replace it as per your business requirement, could be FTP adapter, SOAP or any other technology adapters/application specific adapter.

Prerequisites for implementing this use case: Prior implementation experience with Oracle Integration or Basic knowledge of using Oracle Integration and refer my previous blogs on B2B

Let us look at the with the implementation:

  1. In the navigation pane of Oracle Integration, click Integrations.
  2. On the Integrations page, click Create.
  3. Select App Driven Orchestration as the style to use. The Create New Integration dialog is displayed.
  4. In the What do you want to call your integration? field, enter Inbound EDI via REST, then click Create

Configure the REST Adapter Trigger Connection

On the integration canvas, click the start node and select Sample REST Endpoint Interface as the trigger connection.

The Adapter Endpoint Configuration Wizard opens.

  1. On the Basic Info page, enter the following details:
    1. In the What do you want to call your endpoint? field, enter Receive-EDI.
    2. Enter /inbound_edi as the endpoint's relative resource URI.
    3. Select POST as the action to perform on the endpoint.
    4. Select to configure both request and response for this endpoint and click on Next

 2. On the Request page:

  1. Select Binary in the Select the request payload format field.

Note:

Most EDI documents contain only textual data, but they may also include line breaks and special characters, which are used as delimiters. A few EDI documents contain raw binary data, such as images, along with text. Therefore, select the request payload format as Binary.

  1. Select Other Media Type as the media type you want the endpoint to receive.
  2. In the Media Type field, enter application/EDI-X12.

 https://cdn.app.compendium.com/uploads/user/e7c690e8-6ff9-102a-ac6d-e4aebca50425/2e300097-da52-40c6-b535-eec0ecb127e9/Image/6f123018e910066c44fd47c75210783c/bb3p2.png

 

  3. In the Response page:

  1. Select JSON Sample in the Select the response payload format field.
  2. Click the inline link next to enter sample JSON.
  3. In the resulting page, enter the following sample JSON and click OK.

{

   "translate_result": "xxxx",

   "hasError": false,

   "validationErrors": "xxxx",   "translated_payload":  "xxxx"

}

  1. Notice that JSON is automatically selected as the response media type
  2. Click Next, and on the Summary page, click Done to complete the REST Adapter configuration.
  3. The integration flow is now represented as follows in the canvas and click on Save to save your integration flow.

Configure the EDI Translate Action

Add an EDI translate action to the flow to translate an EDI document into an Oracle Integration XML message.

  1. On the right side of the canvas, click Actions /var/folders/r0/lk8zy4712cn5pyq7_4trwfbc0000gn/T/com.microsoft.Word/Content.MSO/CB3BC83C.tmp, drag EDI Translate, and drop it after the first Receive-EDI element.

The Configure EDI Translate Action wizard opens.

  1. On the Basic Info page, enter EDI-Translate as the name for the action, and click Next.
  2. On the Select Data Formats page, enter the following details:
    1. Leave the Inbound EDI message to Oracle Integration message radio button selected.
    2. Select the document version as 8010 (or 4010..)
    3. Select the document type as 850 (Purchase Order).
    4. Select the document definition as the one which you have created OR Standard.
    5. Select the EDI character encoding as UTF8.
    6. Select Yes in the Perform validations on input data? field. Click Next.

5. On the Summary page, click Done to complete the configuration, Change layout to Horizontal and click on Save to save your integration flow.

Note that the corresponding mapping element is automatically added to the integration flow

Configure Mapping Actions

Configure data mappings for the EDI-Translate action and Receive-EDI action in order to successfully parse the incoming EDI message and translate it to an XML message.

Configure the Map to EDI-Translate Action

  1. Click the Map to EDI-Translate action and select Edit.
  2. Map streamReference on the left to edi-payload on the right, within TranslateInput.
  3. Click Switch to Developer View /var/folders/r0/lk8zy4712cn5pyq7_4trwfbc0000gn/T/com.microsoft.Word/Content.MSO/D7A625AA.tmpand edit the expression for the mapping.

Prefix the function call encodeReferenceToBase64 to the existing edi-payload expression as follows: oraext:encodeReferenceToBase64 (/nssrcmpr:execute/ns20:streamReference ). Click Save

  1. Click Validate and then Close.

Configure the Map to Receive-EDI Action

  1. Click the Map to Receive-EDI action and select Edit.
  2. Click Switch to Developer View /var/folders/r0/lk8zy4712cn5pyq7_4trwfbc0000gn/T/com.microsoft.Word/Content.MSO/95815B48.tmp.
  3. Map edi-xml-document (present on the left within $EDI-Translate, under TranslateOutput) to translated_payload, within the response-wrapper on the right.

Note:

To achieve this mapping, drag and drop get-content-as-string function on to the translated_payload and now drag and drop edi-xml-document with in the () . Click Save.

/var/folders/r0/lk8zy4712cn5pyq7_4trwfbc0000gn/T/com.microsoft.Word/Content.MSO/DB457914.tmp

  1. Map translation-status within the same TranslateOutput element to translate_result on the right.
  2. Map validation-errors-present to hasError.
  3. Map validation-error-report (TranslateOutput > validation-errors) to validationErrors.
  4. Click Validate and then Close.

Activate the Integration

Check for errors, save, and activate the integration flow.

  1. You'll notice an error notification on the canvas. To resolve it, click Actions Menu in the top-right corner of canvas, and select Tracking.
  2. In the resulting dialog, select streamReference on the left and move it to the table on the right.
  3. Click Save.
  4. Save the integration and click Close.
  5. On the Integrations page, click the toggle button against your integration to activate it.
  6. Click Activate in the Activate Integration dialog.

Parse Your First EDI Document

To execute your sample integration, send a request from a REST client tool, such as Postman OR you can use Oracle Integration console to test. If you use OI Console, you can ignore steps 1-3 given below.

Create a request definition on the REST client tool as follows:

  1. Define the request to send an HTTP POST to the URL:                http://host:port/ic/api/integration/v1/flows/rest/INBOUND_EDI_VIA_REST/1.0/inbound_edi
  2. Configure authorization for the request. Select HTTP Basic Auth and provide the username and password to your Oracle Integration instance.
  3. Add an HTTP header with Content-Type as KEY and application/EDI-X12 as VALUE.
  4. Use the sample EDI X12 PO 
  5. Send the request from the REST client.
  6. Verify the response from the integration flow.

Check if the response status is 200 OK and the JSON is displayed as follows:

{

  "translate_result": "Success",

  "hasError": false,

  "validationErrors": "",

  "translated_payload": "<edi-xml-document...>"

}

The translate_result parameter with the value Success indicates that the EDI X12 document was parsed and translated successfully.

For more information, please visit Oracle docs

Refer my other blogs

 

 

 

Be the first to comment

Comments ( 0 )
Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.