Usecase: Here, we will see the following:
- Create an Inbound Backend Integration for receiving the Inbound EDI message.
- Receive Inbound EDI using B2B Trading partner mode.
Following 2 ways we can receive the Inbound B2B message using Trading partner mode:
- Create an Inbound direct backend integration and use it in creating the Transport and Agreement steps.
- While we create Transport and agreement, it will automatically create 2 Integrations, one for receive inbound and one for Send Outbound. Using them, we can get the inbound EDI and send the data to Target systems.
Here we will use the 1st approach.
High level steps:
- Create an EDI documment definition (standard or custom) https://soalicious.blogspot.com/2022/06/work-with-b2b-documents-create-standard.html
- Add Host profile
- Create Trading Partner
- Add Primary information
- Add Contacts
- Add B2B TP Identifiers
- Add Transports and Agreements
- Create a Backend Inbound Integration
Steps in detail:
Add Host profile information:
Add required Identifiers.
I have added EDI Interchange id, EDI Group ID, EDI Interchange ID Qualifier.
Note: If you are using AS2 transport, then we also have to add AS2 Identifier. In this case, I use FTP as Transport, so I dont need AS2 identifier.
Create Trading Partner
Provide Trading partner name.
Provide contacts information like Email, SMS, Phnumber etc.
Provide Trading partner specific B2B Identifiers.
Transports and Agreements:
Click + sign to create Transport.
We will create FTP transport.
Create an agreement for standard 850 document version 4010
Create a Backend Receive Inbound Integration
Use below payload as Rest Trigger Request payload:
{
"type": "MSG",
"id": "12345",
"direction": "INBOUND",
"trading-partner": "ACME",
"document-definition": "PO_850",
"message": [
{
"b2b-message-reference": "biz:0AC400D117503A8246000000347849EB"
},
{
"b2b-message-reference": "biz:0AC400D117503A8246000000347849EA"
}
]
}
Backend Integration flow:
Create an App driven Orchestration pattern and take a REST trigger and configure
Take a For Each action to get each EDI Message.
Add a Switch and add a condition to get your inbound EDI . Here added condition as document-definition ="TEST_850_PO_DOC"
Drag and drop B2B action and configure
Select a mode: here, B2B Trading Partner mode
Direction: Inbound
Operation: Fetch Message
Select the created Document definition
Map the currentMsg >> B2b Message Reference to B2B Action>> FetchMessageInput >> B2B Massage Reference
Now we can call a backend service and map the EDI XML data. Here, we are just logging the EDI XML data.
From body scope >> Fault Handler >> Default Handler
Drag and drop B2b action and select Mark as error option for fault handling.
Map the bodyScopeFault object Errocode,reason,details and CurrentMsg reference.
Add a tracking with Trading partner, document-definition and direction.
Test data - standard 850 inbound EDI:
Saved with 850.edi:
ISA*01*0000000000*01*0000000000*ZZ*4405197800*ZZ*7817373000*101127*1719*U*00400*000003438*0*P*> GS*PO*4405197800*7817373000*20101127*1719*1421*X*004010
ST*850*000000010 BEG*00*SA*08292233294**20101127*610385385
REF*DP*038
REF*PS*R
ITD*14*3*2**45**46
DTM*002*20101214
PKG*F*68***PALLETIZE SHIPMENT
PKG*F*66***REGULAR
TD5*A*92*P3**SEE XYZ RETAIL ROUTING GUIDE
N1*ST*XYZ RETAIL*9*0003947268292 N3*31875 SOLON RD
N4*SOLON*OH*44139 PO1*1*120*EA*9.25*TE*CB*065322-117*PR*RO*VN*AB3542
PID*F****SMALL WIDGET PO4*4*4*EA*PLT94**3*LR*15*CT PO1*2*220*EA*13.79*TE*CB*066850-116*PR*RO*VN*RD5322
PID*F****MEDIUM WIDGET
PO4*2*2*EA PO1*3*126*EA*10.99*TE*CB*060733-110*PR*RO*VN*XY5266
PID*F****LARGE WIDGET PO4*6*1*EA*PLT94**3*LR*12*CT PO1*4*76*EA*4.35*TE*CB*065308-116*PR*RO*VN*VX2332
PID*F****NANO WIDGET PO4*4*4*EA*PLT94**6*LR*19*CT PO1*5*72*EA*7.5*TE*CB*065374-118*PR*RO*VN*RV0524
PID*F****BLUE WIDGET
PO4*4*4*EA PO1*6*696*EA*9.55*TE*CB*067504-118*PR*RO*VN*DX1875
PID*F****ORANGE WIDGET PO4*6*6*EA*PLT94**3*LR*10*CT
CTT*6
AMT*1*13045.94
SE*33*000000010
GE*1*1421
IEA*1*000003438
Reference:
Testing and Monitoring:
File placed in In FTP directory: