Forum Stats

  • 3,759,877 Users
  • 2,251,609 Discussions
  • 7,870,856 Comments

Discussions

File Adapter using it to copy issue

User_3YQO6
User_3YQO6 Member Posts: 21 Red Ribbon

Hi,

My requirement is to copy a bunch of files where I have four parameters source dir, source file, target dir and target file. The info for all the four reside in a database table so what I have is a simple BPEL process which reads the database table and then does a file adapter using sync read and then I've modified my file adapter JCA as below :

<!--Generated by Oracle SOA Modeler version 12.2.1.4.0.190828 at [8/27/21 12:09 PM].-->

<adapter-config name="CopyFile" adapter="file" wsdlLocation="../WSDLs/CopyFile.wsdl" xmlns="http://platform.integration.oracle/blocks/adapter/fw/metadata">

 <connection-factory location="eis/FileAdapter"/>

 <endpoint-interaction portType="SynchRead_ptt" operation="SynchRead">

  <interaction-spec className="oracle.tip.adapter.file.outbound.FileIoInteractionSpec">

   <property name="SourcePhysicalDirectory" value="/localdir"/>

   <property name="SourceFileName" value="IMGB.JPG"/>

   <property name="TargetPhysicalDirectory" value="TargetDirectory"/>

   <property name="TargetFileName" value="TargetFileName.txt"/>

   <property name="Type" value="COPY"/>

   </interaction-spec>

 </endpoint-interaction>

</adapter-config>

I am passing the values at runtime in the invoke as below :

 <invoke name="InvokeFileCopy" partnerLink="CopyFile" portType="ns2:SynchRead_ptt"

        operation="SynchRead" inputVariable="InvokeFileCopy_SynchRead_InputVariable"

        outputVariable="InvokeFileCopy_SynchRead_OutputVariable" bpelx:invokeAsDetail="no">

         <bpelx:toProperties>

     <bpelx:toProperty name="jca.file.SourceDirectory"

             variable="InvokeDB_ReadImagesSelect_OutputVariable" part="FileInfoCollection">

          <bpelx:query>ns3:FileInfo/ns3:sourceDirectory</bpelx:query>

        </bpelx:toProperty>

     <bpelx:toProperty name="jca.file.SourceFileName"

             variable="InvokeDB_ReadImagesSelect_OutputVariable" part="FileInfoCollection">

          <bpelx:query>ns3:FileInfo/ns3:sourceFileName</bpelx:query>

        </bpelx:toProperty>

     <bpelx:toProperty name="jca.file.TargetDirectory"

             variable="InvokeDB_ReadImagesSelect_OutputVariable" part="FileInfoCollection">

          <bpelx:query>ns3:FileInfo/ns3:targetDirectory</bpelx:query>

        </bpelx:toProperty>

     <bpelx:toProperty name="jca.file.TargetFileName"

             variable="InvokeDB_ReadImagesSelect_OutputVariable" part="FileInfoCollection">

          <bpelx:query>ns3:FileInfo/ns3:targetFileName</bpelx:query>

        </bpelx:toProperty>

    </bpelx:toProperties>


I am using Transform activity to pass the values to the output variable. This all works great and the copy is successful if I have only one record in the database. But if I have multiple records in the database the invoke throws an error :

Exception occurred when binding was invoked.
Exception occurred during invocation of JCA binding: "JCA Binding execute of Reference operation 'SynchRead' failed due to: Unable to copy file from source to target.
Unable to copy file from source to target.
Unable to copy  "[email protected]/[email protected]"  to "oracle.xml.parser.v2.XMLNodeLi[email protected]/[email protected]"
Check the error stack and fix the cause of the error.
". 
The invoked JCA adapter raised a resource exception.

That's because the values are not coming in correctly in the invoke anymore. How can I ensure I am able to process more than one row in the file copy ?


Thank you.