Sunday, 15 December 2013

FTP JCA-Properties in SOA 11g

Hi Guys


Lets Discuss about JCA Properties Corresponding to FTP Adapter


Case Scenario:   MOVE the File on FTP server to Another Directory on FTP server


The I/O use cases for the Oracle FTP Adapter are very similar to those for Oracle File Adapter. However, there are a few nuances that need attention.
In this use case you move a file within the same directory, which is similar to a rename operation on the same server. Most FTP servers support the RNFR/RNTO FTP commands that let you rename a file on the FTP server.

You can model only a part of this procedure by using the wizard because the corresponding Adapter Configuration Wizard is not available. You must complete the remaining procedure by manually configuring the generated JCA file.
You must perform the following steps to move a file from a remote directory to another remote directory on the same FTP server:
  1. Create an empty BPEL process.
  2. Drag and drop FTP Adapter from the Component Palette to the External References swim lane. The Adapter Configuration Wizard Welcome page is displayed.
  3. Click Next. The Service Name page is displayed.
  4. Enter a service name in the Service Name field.
  5. Click Next. The Adapter Interface page is displayed.
  6. Click Next. The FTP Server Connection page is displayed.
  7. Enter the JNDI name for the FTP server, and click Next. The Operation page is displayed.
  8. Select Synchronous Get File, enter GET in the Operation Name field, and then click Next. The File Directories page is displayed.
 Change the  JCA file as below

<adapter-config name="FTPSyncRead" adapter="FTP Adapter" wsdlLocation="FTPSyncRead.wsdl" xmlns="http://platform.integration.oracle/blocks/adapter/fw/metadata">
 
  <connection-factory location="eis/ftp/localdomain"/>
  <endpoint-interaction portType="SynchRead_ptt" operation="SynchRead">
    <interaction-spec className="oracle.tip.adapter.ftp.outbound.FTPIoInteractionSpec">
     <property name="SourcePhysicalDirectory" value="Dirl"/>
      <property name="SourceFileName" value="File1"/>
      <property name="TargetPhysicalDirectory" value="Dir2"/>
      <property name="TargetFileName" value="File2"/>
      <property name="Type" value="MOVE"/>
    </interaction-spec>
  </endpoint-interaction>
</adapter-config>


ADD headers 


<bpelx:inputProperty name="jca.file.SourceDirectory"
variable="Dir1"/>
<bpelx:inputProperty name="jca.file.SourceFileName"
variable="File1"/>
<bpelx:inputProperty name="jca.file.TargetDirectory"
variable="Dir2"/>
<bpelx:inputProperty name="jca.file.TargetFileName"
variable="File2"/>


Assign the Values to the Headers:

 <assign name="Assign_FILESyncReada">
      <copy>
        <from expression="'/FTPSyncRead'"/>
        <to variable="Dir1"/>
      </copy>
      <copy>
        <from expression="'/FTPSyncWrite'"/>
        <to variable="Dir2"/>
      </copy>
      <copy>
        <from expression="'Input.txt'"/>
        <to variable="File1"/>
      </copy>
      <copy>
        <from expression="'Move.txt'"/>
        <to variable="File2"/>
      </copy>
    </assign>

Lastly change the composite.xml as below

 <reference name="FTPSyncRead" ui:wsdlLocation="FTPSyncRead.wsdl">
    <interface.wsdl interface="http://xmlns.oracle.com/pcbpel/adapter/ftp/SOATECHBLOG/FTPSyncREad/FTPSyncRead#wsdl.interface(SynchRead_ptt)"/>
    <binding.jca config="FTPSyncRead_ftp.jca"/>
    <property name="UseNativeRenameOperation" type="xs:string" many="false" override="may">true</property>

  </reference>

Note:

Use the SourceIsRemote and TargetIsRemote properties to specify whether the source and target file are on the local or remote file system, as shown 

 <property name="SourceIsRemote" value="false"/> 
 <property name="TargetIsRemote" value="false"/>
 

HappyLearning

                                                                                                            By DeepthiReddy

No comments:

Post a Comment