Friday 6 January 2012

Oracle SOA/AIA/BPEL/ESB/OSB

OSB 11g - Oracle File Adapter debatching XML

Thanks to Niall for helping our blog readers.

I have a large input file adhering to the following XSD -






Business Processing:
The SSN will only be visible in the Response for persons living in the province specified in the header – in this case Munster.

- Sample input -



Such an input file could be large e.g.

1 PersonList Header element (specifying the province we are sending the data to e.g. the Irish province of Munster) and
1000s of Person elements, containing sensitive data such as SSN or as we in Ireland say PSN. So how can we leverage SOA Suite/OSB to do this efficiently?

Throttling is available with the Oracle File adapter so let's leverage it –



I created a simple SOA Composite (File Read --> Mediator --> FileWrite) and tested with the above input.

I checked in FMW console and saw that 3 instances had been created -

Instance 1 - Header + Person 1
Instance 2 - Person 2 + Person 3
Instance 1 - Person 4

Nice that the file adapter de-batching feature which gives us the Person elements wrapped in a



The only issue here is we have to validate the Person/Province against the Header/Province and, as you can see from the above, - it isn't there!

However, we do get this PersonList wrapper, so let's leverage this but changing the XSD slightly to include the destinationProvince as an attribute of the PersonList.



The new input XML file is as follows –



When I test this using the SOA composite I get 3 instances.

e.g.



Looks good – let’s go on to OSB.

OSB
Create an OSB Project and import JCA artifacts you created in JDeveloper



Generate Proxy based on readin_file





Generate Business Service based on writeOutFile



Add a Pipeline & Route Node to the Proxy Service



Route to the Business Service



Create a variable v_PersonList and Assign the $body/exam:PersonList to it

Add a FOR EACH action to the Request Pipeline



The FOR EACH is defined as follows -



As you can see, the FOR EACH includes the following -

Log - Log the number of Persons in the Message



Log - Log the current iteration




Log - the current Person ID



IF THEN --> here we check whether the province values match. If not we need
to wipe the SSN.





Output:



No comments:

Post a Comment

xslt padding with characters call template for left pad and right pad

  Could a call-template be written that took two parameters ?   a string, and a   number) return the string with empty spaces appended t...