Thursday, November 26, 2015

Oracle B2B, Viewing EDI files

For sophisticated developers (like me) EDI files can be viewed in editors, the one which I use is

Liason EDI Notepad

https://www.liaison.com/products/integrate/edi-notepad/compare-versions/

version: Express (Free)

The file which I have shown in my last post just save it with some name and extension as .edi
example: sampleEDI_850.edi and open it in EDI editor. I should look as below.






Anyways viewing the EDI file is the last part. 

Oracle B2B, Introduction

Oracle B2B is a technology which converts XML data to EDI, ebXML, RosettaNet etc formats and vise versa .

EDI, RosettaNet etc are electronic versions of documents in a standardized format which are machine readable, have a look at EDI 850 document below.

This document is similar to XML, or it will be correct to say XML is a better human readable form of EDI, these formats came into existence in early 1960's, each character,*, space has a code behind it, which was agreed upon when these standards were made. 

Just to explain how impressive these codes are, if the similar data is send in XML it will be 100 times bigger.

In crude SOA terms B2B is similar to file adapter which converts XML to flat file, and in this case the flat file is a EDI file, and it also polls for the EDI file and converts it back to XML and can place it in JMS Q or AQ from where SOA can pick it up for further processing.

ISA*01*0000000000*01*ABCCO     *12*4405197800     *01*999999999      *101127*1719*U*00400*000003438*0*P*>
GS*PO*4405197800*999999999*20101127*1719*1421*X*004010VICS
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

Dynamically changing XSLT file name in BPEL

I recently came across a scenario where multiple BPEL process were doing the same work, the only difference was the transform activity. So for re-usability we  create a single Composite which dynamically pick the XSLT file on the basis of requirement from MDS.

So the benefit will be every time there is a need to create a new composite we just have to create a new XSLT file and place it inside MDS and the BPEL process will pick it up.

To achieve this transform activity allow us to pick the file from MDS however we can't change the name of the file dynamically.

However assign activity allows us to execute the XSLT file we have  a function

ora:executeXSLT(location of XSLT file, input xml)

Below source code from Assign will make more sense


 
    dvm:lookupValue("XSLTFileLocations_MDS.dvm","TARGET_SYS",$FileName,"MDS_XSLT_LOC","N/A")
    $XSLTFileName/ns3:XSLTFileLoc
 
 
    ora:processXSLT($XSLTFileName/ns3:XSLTFileLoc,$ReceivePO_Consume_Message_InputVariable.body)
    $InvokePO_send_InputVariable.body
 

 
Below is how the dvm looks like




Friday, November 6, 2015

Business Rules, IF THAN, Otherwise

Recently I came across a scenario where the existing business rules implementation fails because the condition which it was checking did not exist.

Rule 1
IF (Name="YATAN")
THAN
FULL_NAME="YATANVEER SINGH"

Rule 2
IF (Name="YAGYA")
THAN
FULL_NAME="YAGYA VIR SINGH"

The above rule works fine to the point it checks for particular inputs YATAN or YAGYA, however as soon as it checks for something else it throws error.

Fact not found in the rule engine working memory, rule session execution failed.
The rule session 26557551 failed because an instance of the fact com.oracle.xmlns.frd_wms.testbr.bpel.ProcessResponse could not be found in the working memory of the rule session.
This is most likely a rule modeling error. The decision service interaction expects the fact instance to exist in the working memory of the rule session. Check the rule actions in rule designer and make sure that a fact of the expected type is being asserted. If the error persists, contact Oracle Support Services.

So we can handle this by putting a otherwise condition, however
After some research, I found that there is  no otherwise :)

So came with a solution (not the smartest)

I put a new rule

Rule 3
IF (Name != "YATAN")  and (Name != "YAGYA")
THAN
FULL_NAME="YUGANSH VIR SINGH"