Monday, 28 November 2016

File / FTP Adapter SOA - COPY / MOVE / DELETE Operation

File Adapter Move / Copy Operation :

File Adapter or FTP Adapter in 11g won't direct support in GUI mode.

In Some scenarios we need to perform move or copy   from one folder to another folder. Following code will support 

FileMove.jca

MOVE Operation 
=================================================================
<adapter-config name="FileMove" adapter="File Adapter"
                wsdlLocation="FileMovet.wsdl"
                xmlns="http://platform.integration.oracle/blocks/adapter/fw/metadata">
    <connection-factory location="eis/FileAdapter"/>
    <endpoint-interaction portType="FileMove_ptt" operation="FileMove">
        <interaction-spec className="oracle.tip.adapter.file.outbound.FileIoInteractionSpec">
            <property name="SourcePhysicalDirectory" value="D:\Krishna"/>
            <property name="SourceFileName" value="HelloWorld.txt"/>
            <property name="TargetPhysicalDirectory" value="D:\Moorthi"/>
            <property name="TargetFileName" value="HelloWorldNew.txt"/>
            <property name="Type" value="MOVE"/>
        </interaction-spec>

    </endpoint-interaction>
</adapter-config>
=================================================================

COPY Operation 
=================================================================
<adapter-config name="FileMove" adapter="File Adapter"
                wsdlLocation="FileMovet.wsdl"
                xmlns="http://platform.integration.oracle/blocks/adapter/fw/metadata">
    <connection-factory location="eis/FileAdapter"/>
    <endpoint-interaction portType="FileMove_ptt" operation="FileMove">
        <interaction-spec className="oracle.tip.adapter.file.outbound.FileIoInteractionSpec">
            <property name="SourcePhysicalDirectory" value="D:\Krishna"/>
            <property name="SourceFileName" value="HelloWorld.txt"/>
            <property name="TargetPhysicalDirectory" value="D:\Moorthi"/>
            <property name="TargetFileName" value="HelloWorldNew.txt"/>
            <property name="Type" value="COPY"/>
        </interaction-spec>

    </endpoint-interaction>
</adapter-config>
=================================================================


DELETE Operation 
=================================================================
<adapter-config name="FileMove" adapter="File Adapter"
                wsdlLocation="FileMovet.wsdl"
                xmlns="http://platform.integration.oracle/blocks/adapter/fw/metadata">
    <connection-factory location="eis/FileAdapter"/>
    <endpoint-interaction portType="FileMove_ptt" operation="FileMove">
        <interaction-spec className="oracle.tip.adapter.file.outbound.FileIoInteractionSpec">
            <property name="TargetPhysicalDirectory" value="D:\Moorthi"/>
            <property name="TargetFileName" value="HelloWorldNew.txt"/>
            <property name="Type" value="DELETE"/>
        </interaction-spec>

    </endpoint-interaction>
</adapter-config>
=================================================================


Invoke Change in BPEL :


 <invoke name="Invoke1" inputVariable="Invoke1_FileMove_InputVariable"
                outputVariable="Invoke1_FileMove_OutputVariable"
                partnerLink="FileAdptMoveTest" portType="ns1:FileMove_ptt"
                operation="FileMove" bpelx:invokeAsDetail="no">
<bpelx:inputProperty name="jca.file.SourceDirectory" variable="sourceDirectory"/>
<bpelx:inputProperty name="jca.file.SourceFileName" variable="sourceFileName"/>
<bpelx:inputProperty name="jca.file.TargetDirectory" variable="targetDirectory"/>
<bpelx:inputProperty name="jca.file.TargetFileName" variable="targetFileName"/>
</invoke>

No comments:

Post a Comment