cancel
Showing results for 
Search instead for 
Did you mean: 

Issue: The Same filename from a SFTP Sender and File Reciever Adapter

Former Member
0 Kudos

Hi

     I've a secenerio where no mapping involved. I simply should get the files from vendor's SFTP server and store the files with the same filename in local UNIX server.
It is working when it is File sender and File receiver adatper. I followed the same setup(i.e.,in the ASMA section) in SAP's new SFTP Sender adapter but I see the below error when the File Receiver adatper trying to store the same file in my local UNIX server.

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Attempt to process file failed with com.sap.aii.adapter.file.configuration.DynamicConfigurationException: The Adapter Message Property 'FileName' was configured as mandatory element, but was not supplied in the XI Message header

MP: exception caught with cause com.sap.engine.interfaces.messaging.api.exception.MessagingException: com.sap.aii.adapter.file.configuration.DynamicConfigurationException: The Adapter Message Property 'FileName' was configured as mandatory element, but was not supplied in the XI Message header

Exception caught by adapter framework: The Adapter Message Property 'FileName' was configured as mandatory element, but was not supplied in the XI Message header

------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Thanks,

raj.

Accepted Solutions (0)

Answers (1)

Answers (1)

naveen_chichili
Active Contributor
0 Kudos

Hi Raj,

Are you trying to create file name dynamically or did you mention file name in Channel?

Please go through the below blog for more details.

http://scn.sap.com/community/pi-and-soa-middleware/blog/2012/04/11/sap-sftp-sender-adapter-a-quick-w...

Regards,

Naveen.

Former Member
0 Kudos

Naveen, I'm not using any MAP here and also I'm not creating any filename. The requirment is i just receive the file from SFTP receiver and I should put the file with the same filename in my local server. As I mentioned above the sender is SFTP adapter and the Receiver is File adatper.

former_member184789
Active Contributor
0 Kudos

Hi

Do  as below,

1.In ESR create only an imported archive with code for dynamic config, a sample of which is given below, create an operation mapping but without existing service Interfaces..that is type in any dummy names & a real namespace in operation mapping & add the imported archive with Java mapping.

2. In ID, create sender & receiver Channels & Select adapter specific attributes in both.

3. Create a configuration, with the dummy service Interfaces. Select the operation mapping. As the service Interfaces do not exist, you have to type in the names manually.

Here is a sample code for your Java mapping. It might not be completely as per you requirement, but you can modify it:

package com.sap.pi.java.mapping;

import java.io.InputStream;

import java.io.OutputStream;

import java.text.DateFormat;

import java.text.SimpleDateFormat;

import java.util.Date;

import java.util.Map;

import com.sap.aii.mapping.api.AbstractTransformation;

import com.sap.aii.mapping.api.DynamicConfiguration;

import com.sap.aii.mapping.api.DynamicConfigurationKey;

import com.sap.aii.mapping.api.StreamTransformationConstants;

import com.sap.aii.mapping.api.StreamTransformationException;

import com.sap.aii.mapping.api.TransformationInput;

import com.sap.aii.mapping.api.TransformationOutput;

public class DynamicFileName extends AbstractTransformation{

     public void transform(TransformationInput transformationInput, TransformationOutput transformationOutput) throws StreamTransformationException

     {

         String oldFilename = "";

         String newFilename = "";

      try

      {

           InputStream inputstream = transformationInput.getInputPayload().getInputStream();

           OutputStream outputstream = transformationOutput.getOutputPayload().getOutputStream();

           Map mapParameters = (Map) transformationInput.getInputHeader().getAll();

           mapParameters.put(DynamicConfigurationKey.create("http://sap.com/xi/XI/Dynamic",StreamTransformationConstants.DYNAMIC_CONFIGURATION), "");

           DynamicConfiguration conf = (DynamicConfiguration) mapParameters.get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);

           DynamicConfigurationKey key = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File", "FileName");

            String FileName = conf.get(key);

           conf.put(key, Filename);

           byte[] b = new byte[inputstream.available()];

           inputstream.read(b);

           outputstream.write(b);

      }

      catch (Exception exception)

      {

       getTrace().addDebugMessage(exception.getMessage());

       throw new StreamTransformationException(exception.toString());

      }

}

}

You may have to modify it since you may not need all this stuff,but it might help you a bit.

Former Member
0 Kudos

Hi Adarsh, just including the http://sap.com/xi/XI/System/File in the ASMA namespace resolved my issue. Anyway, thanks for your reply.

michael_hall1
Explorer
0 Kudos

Thanks to everyone on this thread for the useful information.  I, too, had the same issue when moving 3 separate files with the SFTP adapter, but trying to keep same filename.  Our ASMA included just http://sap.com/xi/XI/System and was throwing the same error in the Message Monitor.  I do not understand why, but just by adding 'File' to make it http://sap.com/xi/XI/System/File resolved our issue and they were able to land.

Former Member
0 Kudos

Same here!

anupam_ghosh2
Active Contributor
0 Kudos

Thank you for updating the thread with the solution.