Monday, July 11, 2011

FTP Adapter - Reading File Name that changes for each instance

We often end up in some business requirements where we need to read a file or write to a file where file name is decided based on the message of the instance.

Consider an example where we have one order process which calls another application asynchronously to validate the order. If the validation is successful , it places a file in a FTPshare with name _Success.xml else _Failed.xml. Now the Order process instance will need to read the file from that FTP share. So here the requirement is to read a file whose name would change for every Order ( ie., for every instance).
So here we need to dynamically change the "file name" of the FTPAdapter configuration.

Providing FileName Dynamically :

1. Create a OutboundHeaderVar(lets say outHeaderVar) in the scope. This is of messageType {http://xmlns.oracle.com/pcbpel/adapter/ftp/}OutboundHeader_msg. (Or) you can select the message Type -> click on browse -> Type Explorer -> Project WSDL files -> Select ftpAdapterOutboundHeader.wsdl -> MessageTypes->OutboundHeader_msg.

2. Drag an assign activity and select the from-spec query like for eg : concat('bpws:getVariableData("orderNumber")','_Success.xml').In the To-Spec Query select
outHeaderVar/outboundHeader Query = "/ns2:OutboundFTPHeaderType/ns2:fileName"

This will assign the file name as required at the design time dynamically.

5 comments:

  1. Hi,

    This site is very nice.I found this site when i was googling.This site had giving me information like how to provide filename dynamically.Thanks for sharing this.

    Oracle R12 Upgrade.

    ReplyDelete
  2. Can you expand on this:
    click on browse -> Type Explorer -> Project WSDL files -> Select ftpAdapterOutboundHeader.wsdl -> MessageTypes->OutboundHeader_msg.

    Your instructions seem pretty specific to some sort of example project. My wsdl for my ftp adapter(s) does not show this message type.
    Do I need to add something to the wsdl?

    example:
























    ReplyDelete
  3. I was going to put the wsdl up but can't get it past the filters.

    ReplyDelete
  4. In the properties of the BPEL Receive activity, which receives the content from the File reader adapter, you can set the property "jca.file.fileName" to a string variable (that you create for this purpose).
    You can also uyse "jca.file.Directory" to get the file path.

    At the opposite, you can use those same properties for an Invoke activity invoking a file writer adapter. This will set the path and filename of the file to write.

    ReplyDelete
  5. Oracle apps and Fusion Self Paced Training Videos by Industry Experts. Please visit https://oracleappsfusion.teachable.com

    ReplyDelete