Wednesday, September 15, 2010

Create output file of same name as input file using file adapter in SOA Suite 11g

For a working sample of SOA Suite 10g Please refer to following document


We will discuss in this exercise how to do the same in 11g

Create a new Project



Make it an empty project



Drag and drop a dile adapter in exposed service swinlane

this will read the file from a directory



Specify the input directory which has to be polled



in the input file name pattern specify *.* which basically means all type of file with any extension.



Keep on saying next and choose the opaque schema



Keep sayin next and finish your wizard.

Now drag and drop again one more file adapter in external reference swimlane this will write the data to some output folder location.





choose the output folder location and the output file name format

I have chosen the default one po_%SEQ%.txt

Again choose opaque schmea for this and finish this wizard also.




========================

Now inbound and outbound adapter service are created ,now drag and drop one mediator in the component section.




connect the inbound to mediator and mediator to outbound so that your service should now look like this.




Now double click on mediator and create a transformation file which will basically map the input file to output file



Once mapped saved you project and deploy it to you application server.

NOw drag and frop some file in to input folder which is being polled and observer the output in output folder location.



As soon as you will put any file in input folder it will be polled by file adapter and it will generate a file called PO_1.txt in output folder.

So it is working fine but we have put an input file called input.txt and we want that the output file generate should also be named as input.txt

For that we will again go to our mediator service and create one assign activity.




We will create a copy operation where in we will assign jca.file.FileName of input to jca.file.FileName fo output as shown below



Now save this and again redeploy your project.

Now if you will put a file you will get the output file of same name as input file.

No comments: