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"


Friday, July 24, 2015

Getting Started with Oracle Event Processing 11g, Packt Publishing : Review

I am working on Oracle Event processing, so thought of getting a book which can help me,
over the internet I found the book "Packt Publishing: Getting Started with Oracle Event Processing 11g".

This is a completely useless book, the author has no idea what he is writing, he has not explained a single sample, he has simply told like we need to put entry in this and that file, the steps are not clear, actually there are no steps. The attached project examples are not getting compiled. The sample code (Java) given the pdf book is in the form of pictures, so we cant copy paste it.

I am very upset with Packt Publishing who has allowed such a useless book to be publish under its banner with name as "Getting Started".

Wednesday, July 22, 2015

Oracle Complex Event Processing, Installation

I have installed the Oracle Event Processing 11.1.1.7 on my Windows 7 32 bit machine.

To get the software we can follow the below steps.

  1. Go to https://edelivery.oracle.com and sign-in/register.
  2. On the Media Pack Search, search for Oracle Fusion Middleware and your platform (Win 32 bit)
  3. Scroll down and click on the link for Oracle Fusion Middleware 11g Media Pack.
  4. Select Download for Oracle Event Processing 11g (11.1.1.7.0) for Win 32


Follow the below steps:

1. Unzip the file and right click and run as admin.


2.

3. 


4. Choose custom so you get the samples.



5.

6. 


7. 


8. 



9.

10.

11. 


We are done with the OEP software and server installation, next lets create a domain.

 12.

13. 



14.


15.

16.


17.


18.



19.


20.

Domain creation complete, now lets make our Eclipse IDE ready for development, for this we will
have to use the plugins.

21.



22.



23.

24.


25.


26.


27.


28.


We need to restart the Eclipse to take effect, next we need to integrate the OEP server integrate with
Eclipse so that we can start/ stop/ restart and deploy directly.

29.


30.


31.

32.


33.


34.



35. Now click on the green button to start the server.


36. Open the URL to see the server page.


The page will not login, go to eclipse > servers, double click to open the server overview

37. Change the passwords here to weblogic/Welcome1, restart the server again and then login.




38.


Sunday, December 21, 2014

How to invoke sql query from OSB - Proxy with transformation

This is in continuation to my last post where I have shown how to make a OSB pass through.

Using Proxy to transform

This is more interesting as we have some control over the data.

Lets go back to JDeveloper, where we will create a concrete WSDL file and two XSLT files each for input and output. We can create a dummy BPEL process which will create all these files.




Inside the BPEL process, use the invoke activity to invoke the DB adapter and use transform activity both before invoke and after where we pass input/output to DB adapter. This gives us 2 XSLT files and once we deploy this composite we can download the concerete WSDL. Copy these 3 files to Eclipse OSB project.




Copy the XSLT and WSDL file to OSB project


Now we are ready to work with the proxy service.

Create a new proxy service 'GetEmployeeDetails_Transform_PS', on the General tab, select WSDL Web service and browse for the WSDL we have copied from JDeveloper 'GetEmployeeDetails.wsdl'
and select GetEmployeeDetailsBPEL_pt press OK.





Now go to Message Flow tab, here we will invoke the business service and transform the input and output.



Drag and drop Pipeline pair node in the flow, this explicitly gives us request and response.
Next drag and drop stage in the request pipeline, inside stage drag and drop Service callout.

Service callout is more like a invoke activity.

Click on service callout in the flow, this will open its properties, click on browse for service and look for our business service, this is very much the same as BPEL invoke activity.


Click on OK and select the required operation from drop down in Invoking, also give name for the input and output variable for this invocation.



In BPEL terms the invoke activity is configured, next we need assign/transform before and after the invoke to pass input and receive output.

Drag and drop a Assign activity on the Request action of Service callout.



Click on the assign activity to open its properties.


Now this assign is completely different from BPEL assign activity.
This assign is combination of BPEL Assign and Transform activity.

Our task right now is to use XSLT (Transform)

Here Variable means target variable.

Expression can be either a simple XPath, XSLT, XQuery etc


Now lets click on expression and then select XSLT tab, click on browse to select required XSLT file.




Input document is the variable which we will pass as input XML to XSLT



Click on OK and mention the variable for input XML


We are done with passing the input to call the business service. Next task is to get the output and pass it to OSB response, however we cant use assign activity here.

Reason ? we are passing the response back to the body of the SOAP message, if we use assign, it will try to overwrite the whole body with the XML, we have to only change the data inside the node of body, for this we will use replace activity and we will select the option of replace node contents.




In variable: Target i.e. where will the replace happen, and the XPath tells where exactly on the In variable it will happen, . (dot) in XPath is on the same node.

In the expression go to XSLT resource browse for output XSLT, and the Input document will be $EmployeeDetailsSelect_Output, this is actually the variable which has receive data after invoking the business service (service call out).



We are done lets deploy and test it.