Friday, July 15, 2022

Process an Inbound EDI Batch File Using the Stage file action | Standalone mode | B2B for Oracle Integration

Usecase: Here, we will see how to create a B2B flow, using the stage file and B2B actions, to process an inbound EDI batch file and send a functional acknowledgment for the file back to the sender.

Implementation Steps:

Step1: Create a scheduled orchestation pattern and list all the EDI Batch files



Step2: For each file, download the incoming EDI batch file to Oracle Integration.





Step3: Use a stage file action to debatch EDI documents from the downloaded batch file.

Using a for-each action, iterate over the repeating elements to handle one EDI document at a time.


Read file in segments

Specify the structure of the file contents as EDI document.


A repeating element EDI-Document-Instance is generated for each EDI document debatched.

For each EDI-document-instance.



Step4: Use the B2B action and parse one EDI document at a time.

Choose Standalone mode


Choose the Doc type details.


Map to EDI-Translate action.

edi-payload
tracking-info
edi-encoding
routing-info(map each child element from source to target)
validation-errors to passthrough-errors(map each child element from source to target)



Step5: Check if the B2B action completed successfully. You can do this by verifying if translation-status is either a Success or Warning. If the status is either of the two, use a map action to transform the EDI-XML into a backend application message. 

In my case, I wrote the EDIXML string file to a ftp location.






oraext:encodeBase64($varPOEDIXMLASString)

Step6: 
After the entire batch is parsed, send the functional acknowledgment document back to the original sender.

The B2B action generates an EDI X12 997 (Functional Acknowledgment) for the last EDI document it handles from a batch.This acknowledgment document contains the status information for the entire batch of all EDI documents, and according to the EDI X12 standard, you should transmit this document back to the originating trading partner after the entire batch has been parsed.

Check functional-ack-present is true


In my case, wrting this 997 to a ftp location.







Integration flow:


Left side:


Right side:


After a file is processed, rename it with the .processed file extension to ensure that the same file is not picked for processing again in a future execution.

Testing:

Input:


Output:
850

997


Thursday, July 14, 2022

Encode Base64 function strips off XML Tags in the payload | Oracle Integration cloud

Today I was working to write XML file where the FTP adapter was assigned an opaque schema. Due to the opaque schema, I used encodebase64() to write the XML contents to the FTP directory but I observed that the xml tags were strippped off in the payload.

This is a known issue. We have to do the following steps to perserve the XML tags:

  1. Use ora:getContentAsString() xpath function to assign the XML contents as string to a local variable.
  2. Use the encodebase64() to encode the variable response and map to opaqueElement.

Screenshots:




EDI UN/EDIFACT Evelope structure | B2B for Oracle Integration

UN/EDIFACT defines the following envelope structure:



EDI X12 Envelope structure | B2B for oracle Integration

EDI X12 defines the following envelope structure:


For more details follow Oracle blog:

https://docs.oracle.com/en/cloud/paas/integration-cloud/integration-b2b/edi-x12.html#GUID-94FC9948-369D-4AD0-A2C2-764A81801D0D

Monday, July 11, 2022

Generate Outbound EDI from an Application Message using Standalone mode | B2B for Oracle Integration

Usecase: Here, we will generate outbound 850 EDI using standalone mode and REST request -response pattern.

Implementation Steps:

Step1: create a Trading-Partner-Lookup to keep all the Host company and TP related EDI Interchange ID, Group Id and Qualifier.


Step2: Create an App driven Orchestration style and configure Rest trigger to post Application data and receive back the EDI payload.





Step3: Add B2B action and configure it for the outbound direction.




Step4: configure the map action that occurs between rest adapter and B2B action to transform the back end application XML message to edi-xml-document.

Part1: specify the edi delimiters 

Here, I used the following inside the edi-xml-document > headers > interchange-ctrl elemnt

element-separator : *

segment-terminator: ~

subelement-separator: :


Part2: Using the created TP lookup , insert the EDI Identifiers in the Interchange and Group Headers.

Under edi-xml-document > headers > interchange-ctrl.

sender-id-qualifier: dvm:lookupValue("tenant/resources/dvms/Trading-Partners-Lookup","TPID","Host Company","EDI_InterchangeID_Qualifier","TP Not Found")

sender-id: dvm:lookupValue("tenant/resources/dvms/Trading-Partners-Lookup","TPID","Host Company","EDI_Interchange_Identifier","TP Not Found")

receive-id-qualifier:

dvm:lookupValue("tenant/resources/dvms/Trading-Partners-Lookup","TPID",/nssrcmpr:execute/ns23:POMsgOutput/ns23:tradingPartnerId,"EDI_InterchangeID_Qualifier","TP Not Found")

receive-id:

dvm:lookupValue("tenant/resources/dvms/Trading-Partners-Lookup","TPID",/nssrcmpr:execute/ns23:POMsgOutput/ns23:tradingPartnerId,"EDI_Interchange_Identifier","TP Not Found")


Under edi-xml-document > headers > group

app-senders-code:

dvm:lookupValue("tenant/resources/dvms/Trading-Partners-Lookup","TPID","Host Company","EDI_Group_Identifier","TP Not Found")

app-receivers-code:

dvm:lookupValue("tenant/resources/dvms/Trading-Partners-Lookup","TPID",/nssrcmpr:execute/ns23:POMsgOutput/ns23:tradingPartnerId,"EDI_Group_Identifier","TP Not Found")


Part3: Map the Transaction data


Note: EDI control numbers are generated automatically, we dont need to map them.
  1. Interchange Control number (ISA13, IEA02)
  2. Group control number(GS06,GE02)
  3. Transaction set control number(ST02, SE02)
SImilarly, Date and Time fields in the interchage and group headers are also auto generated based on the current time stamp. Other remaining fields are assigned defaults, including those in the trailers element.

Step5: check if the EDI translation completed succeasfully by verifiying that translation-status is either a Success or Warning.


Step6: If translation success, map the tranlated edi-payload to stream reference of the rest response. Use decodeBase64ToReference() function to convert from base64 data to reference.


Add tracking


Integration flow:




Test with valid xml data.


Response:


Featured Post

11g to 12c OSB projects migration points

1. Export 11g OSB code and import in 12c Jdeveloper. Steps to import OSB project in Jdeveloper:   File⇾Import⇾Service Bus Resources⇾ Se...