3 Replies Latest reply: Sep 2, 2013 4:34 AM by JF4MW RSS

    Can a directory to be created if it does not exist on FTP server?

    Alena

      Hello SOA experts,

       

      We are good with most common usage of all Adapters. But recently, I am facing a challenge when archive files on FTP server.

       

      Archive files need to be placed into different folders for each month. For instance, ./archive/201308 for files archived in August. Next month, a new directory ./archive/201309 should be created, ideally automatically.

       

      My question is, can I do through some configuration and properties setting to let SOA create a remote target directory when it does NOT exist?

       

      We maintained multiple archive folders for different typr of documents. It is really a hassle to create them manually. And if the target directory does not exist, it would throw errors.

       

      Thank you very much in advance.

       

      Alena Li

      CGI

        • 1. Re: Can a directory to be created if it does not exist on FTP server?
          JF4MW

          Hi, After reading your post, I myself wanted to test this out. I thought that by configuring the following in the Adapter Wizard it would create the remote directory for me:

           

          <adapter-config name="FW" adapter="File Adapter" wsdlLocation="FW.wsdl" xmlns="http://platform.integration.oracle/blocks/adapter/fw/metadata">

           

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

            <endpoint-interaction portType="Write_ptt" operation="Write">

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

                <property name="PhysicalDirectory" value="C:\Archive"/>

                <property name="Append" value="false"/>

                <property name="FileNamingConvention" value="%SEQ%\test.txt"/>

                <property name="NumberMessages" value="1"/>

              </interaction-spec>

            </endpoint-interaction>

          </adapter-config>

           

          It failed on my BPEL instance however I could see that it was trying to create the file. When I created all destinations it was able to create it.

           

          This is my recommendation from what I understand you'd like to accomplish:

           

          Create the different Year&Month folders on your destination from Jan to Dec:

          201301

          201302

          201303

          201304

          201305

          201306

          201307

          201308

          201309

          201310

          201311

          201312

          (You can actually create as many as you want going to 2090 if you want...

           

          Add the below config to your JCA File:

           

          <adapter-config name="FW" adapter="File Adapter" wsdlLocation="FW.wsdl" xmlns="http://platform.integration.oracle/blocks/adapter/fw/metadata">

           

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

            <endpoint-interaction portType="Write_ptt" operation="Write">

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

                <property name="PhysicalDirectory" value="C:\Archive"/>

                <property name="Append" value="false"/>

                <property name="FileNamingConvention" value="%yyyy.MM%\filename"/>

                <property name="NumberMessages" value="1"/>

              </interaction-spec>

            </endpoint-interaction>

          </adapter-config>

           

          This will allow the files to be dynamically created in the correct directories.

           

          This is a work-around and I hope this works for you.

          • 2. Re: Can a directory to be created if it does not exist on FTP server?
            Alena

            Thank you, JF4FM for testing my use case. "%yyyy.MM%\filename" is good point.  I will improve my process.

             

            However, you can reproduce my problem "when the destination directory doesn't exist on remote SFTP server, BELP throw error" right?

             

            Oracle Support responded with "If the directory does not exist on the remote system, we create them on first request". So it seems the folder should be created on the first request.

             

            Thank you for clarifying,

            Alena

            • 3. Re: Can a directory to be created if it does not exist on FTP server?
              JF4MW

              Yes, I must say it's quite weird that it didn't work... I was worried that it might have had something to do with file access on my local windows and result might be different on Linux or using FTP

              Writing some code and using Java Embedding might also be something worth looking at