Oracle SOA FTP Adapter: Get File Name

 

Create a Test Project

testsoaftpadapter_proj_1

* Add a new SOA Project to your solution:
– project name: TestFTP
Empty BPEL
* In composite.xml file, add a new FTP Adapter to the exposed service lane.

<adapter-config name="GetFile" adapter="FTP Adapter" wsdlLocation="GetFile.wsdl" 
    xmlns="http://platform.integration.oracle/blocks/adapter/fw/metadata">
 
  <connection-factory location="eis/ftp/ALIS" UIincludeWildcard="*.zip"/>
  <endpoint-activation portType="Get_ptt" operation="Get">
    <activation-spec className="oracle.tip.adapter.ftp.inbound.FTPActivationSpec">
      <property name="DeleteFile" value="true"/>
      <property name="MinimumAge" value="0"/>
      <property name="PhysicalDirectory" value="/out/AuditData"/>
      <property name="Recursive" value="false"/>
      <property name="PollingFrequency" value="60"/>
      <property name="FileType" value="ascii"/>
      <property name="IncludeFiles" value=".*\.zip"/>
      <property name="UseHeaders" value="false"/>
    </activation-spec>
  </endpoint-activation>
</adapter-config>

* In composite.xml, add a new BPELProcess:
– Name: BPELGetFile
– Template: Define service later

Create a BPEL Variable to Hold File Name

* Open BPELGetFile
* In BPELGetFile, add a new property to hold file name:
– Name: GetFileName
– Type: xsd:string

testsoaftpadapter_GetFileNameProp_1

Collect File Name

* In BPELGetFile, add a new Receive activity.
* Double click Receive activity. Wire it to GetFile FTP adapter:

testsoaftpadapter_receiveActivity_1

* In Properties tab, set jca.ftp.FileName property to the newly created GetFileName variable:

testsoaftpadapter_GetFileNameProp_2

* GetFileName variable now contains the file name received by FTP adapter.

Test File Name

* In BPELGetFile designer, add a new Email Activity
* Email GetFileName property value to test email account:

testsoaftpadapter_EmailGetFileNameVar_1
testsoaftpadapter_EmailGetFileNameVar_2

Create a BPEL Variable to Hold File Name

* Open BPEL process
* Create a new variable, e.g. AuditFileName, of xsd:string type

Collect File Name

* Open BPEL process
* Double click Receive Activity to open Edit Receive window
* Open Properties tab
* Set jca.ftp.FileName property value to the newly crated variable, e.g. AuditFileName

Retrieve File Name from Java Callout

    oracle.xml.parser.v2.XMLElement element = 
        (oracle.xml.parser.v2.XMLElement)getVariableData("AuditFileName");    
    String filename = element.getTextContent();

Pass File Name into Another FTP Adapter

* Open BPEL process
* Double click Invoke Activity to open Edit Invoke window
* Open Properties tab
* Set jca.ftp.FileName property value to the file name variable, e.g. AuditFileName
* Also set type to output

This entry was posted in soa and tagged , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *


*

This site uses Akismet to reduce spam. Learn how your comment data is processed.