After a long time I am blogging again and this time topic is
“Handling positional/delimited flat files
with Oracle B2B 11g”. From past couple of weeks, many B2B developers posted
question on this topic and hence I thought of posting a blog on the same.
So this is what I will cover in this blog –
- Modeling an ecs for a sample positional flat file
- Configuring Oracle B2B for a PFF document
- Testing the outbound and inbound transaction
Step#1 Modeling an ecs for a sample positional flat file:-
First of all we have to create an ecs for a sample
positional flat file (PFF) document. I created below ecs for this blog –
I created this ecs for transferring personal information. I
have added two records in this ecs with 5 fields. First record represents the
headers and hence can occur once at max in the doc. Second record represents
the data and hence can occur infinite times in a doc.
I will configure the same value in B2B to identify the
document uniquely.
Once you will click on “Save” it will automatically generate
a parser schema for your ecs. Parser schema for my ecs looks like –
Once ecs and parser ecs is created, you need to export XSD
(File ->
Export ->
Oracle B2B 2.0) out of it. Also generate test data out of ecs to test the
inbound and outbound flows. This activity is same as what we do for any other
type of document.
Step#2 Configuring Oracle B2B for a PFF document:-
Now we will configure Oracle B2B with the files we have
generated in previous step.
First of all copy the parser ecs file in the directory $Oracle_SOA_Home\soa\thirdparty\edifecs\XEngine\config\schema
(for eg. - D:\OFMW11g\PS3MWHome\Oracle_SOA1\soa\thirdparty\edifecs\XEngine\config\schema)
And add an entry for this parser ecs in $Oracle_SOA_Home\soa\thirdparty\edifecs\XEngine\config\XERegistry.xml.
To add this entry, edit the XERegistry.xml in a text editor and add an entry
like below in “Positional flat parser schemas” list –
Save the changes after adding entry, close the file
XERegistry.xml and restart all the servers.
Now
create a Document Protocol Version, Document Type and Document Definition under
“PositionalFlatFile” on Oracle B2B console –
Use the XSD and transaction set ecs we created in step#1,
while creating document definition.
In Identification tab, we will configure the following
values to let B2B uniquely identify this document-
Identification Value =
SERIALNUM
Identification Start
Position = 1
Identification End Position = 9
Now configure both inbound and outbound agreement for same
doc-def –
As you can see, I have kept validation and translation
enabled in both the agreements.
Validation option is used to indicate B2B to validate the
incoming/outgoing native format document against the ecs configured in
respective document definition. Translation option is used to indicate B2B to
translate the incoming flat file to XML or to translate an outgoing XML to flat
file.
Save, validate and deploy both the agreements.
Step#3 Testing the outbound and inbound transaction:-
Go to Oracle B2B reports section and make sure that message state is “MSG_COMPLETE”. If transaction completes successfully, you will see a positional flat file on the remote trading partner side –
Similarly, to test an inbound flow, pass the positional flat
file to B2B through an external listening channel. Go to Oracle B2B reports
section and make sure that message state is “MSG_COMPLETE”. If transaction completes successfully, you will
see a corresponding XML file on the host trading partner side (in internal
delivery channel). You may check Application Message Report to see the content
of translated XML.