File adapter - How to pass File name and path at runtime

Hi gurus,
We want to use PI 7.0 as an ftp server and expose the config as a webservice where the service consumer can pass one or more file names and the path to pick them and drop them on a fixed ftp server.
So precisely, I need to be able to set the file name, target directory parameters in both sender and receiver file/ftp adapters at runtime. is this possible at all ?
I am aware of passing Adapter specific parameters from sender file adapter to receiver file adapter to create the same folder structure and file names. But my requirement is different. I hope I am clear.
Could I please get some advise on this .
Thanks & Kind Regards,
Jhansi.

Hi Jhansi,
Either you can go ahead with dynamic configuration as said by other SDN'ers. Else can go with Java Mapping:
Here is the code for Java Mapping:
import com.sap.aii.mapping.api.*;
import java.io.*;
import java.text.*;
import java.util.*;
public class GetDynamicConfiguration implements StreamTransformation {
private Map param;
public void setParameter(Map map1) {
this.param = map1;
public void execute(InputStream inputstream, OutputStream outputstream) throws StreamTransformationException {
try {
AbstractTrace trace = null;
// a) Set ouput File name
String directory=null;
trace = (AbstractTrace)param.get(StreamTransformationConstants.MAPPING_TRACE );
param.put(DynamicConfigurationKey.create("http://sap.com/xi/XI/Dynamic", StreamTransformationConstants.DYNAMIC_CONFIGURATION), "");
DynamicConfiguration conf = (DynamicConfiguration) param.get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
DynamicConfigurationKey key = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File", "FileName");
DynamicConfigurationKey key1 = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File", "Directory");
String filename =conf.get(key);
conf.put(key, filename);
trace.addInfo("File name is "+filename);
if(filename.equals("in.txt"))
directory = "/home/ftpxi/in";
if(filename.equals("test.txt"))
directory = "/home/ftpxi/in/test";
if(filename.equals("shweta27.txt"))
directory = "/home/ftpxi/in/test";
trace.addInfo("Directory name is "+directory);
conf.put(key1, directory);
// b) Just copy input file to output file
byte[] b = new bytehttp://inputstream.available();
inputstream.read(b);
outputstream.write(b);
} catch (Exception exception) {
exception.printStackTrace();

Similar Messages

  • How to pass user name and password in openConnection method ?

    Hi, Exports,
              I am trying to post data from applet to another application which is
              protected by network password.
              How to pass user name and password when I use openConnection method? In java
              doc, this method looks like do not accept these two parameters.
              Thanks
              ----- my code in applet ---------
              URL url = new URL("http://127.0.0.1/xml/index.cfm");
              URLConnection connection = url.openConnection();
              connection.setDoInput(true);
              connection.setDoOutput(true);
              connection.setUseCaches(false);
              connection.setAllowUserInteraction(false);
              DataOutputStream dos = new DataOutputStream(connection.getOutputStream());
              dos.writeBytes("POST " + path + " HTTP/1.0\r\n");
              dos.writeBytes("Referer: http://127.0.0.1/XML/index.cfm\r\n");
              dos.writeBytes("Content-Type:
              multipart/form-data;boundary=---------------------------7d0b414b04\r\n");
              dos.writeBytes("Host: "+host+":"+port+"\r\n");
              dos.writeBytes("Content-Length:" + buff.length()+"\r\n");
              dos.writeBytes("Connection: Keep-Alive\r\n\n");
              dos.writeBytes("-----------------------------7d0b414b04\r\nContent-Dispositi
              on: form-data;name=\"xmlDoc\"\r\n\r\n");
              dos.writeBytes(buff.toString());
              dos.writeBytes("\r\n-----------------------------7d0b414b04--\r\n");
              dos.close();
              

    you need to negotiate Authentication in ur applet code...
              For example:
              If u r using Form based auth u need to send Post a request with j_user_name &
              j_password to the action j_security_check. and when server returns back the
              cookie
              u need to hold it and pass that cookie to the each and every request made to the
              protected application.
              Basically u need to imitate the browser.
              regards
              aseem
              David wrote:
              > Hi, Exports,
              >
              > I am trying to post data from applet to another application which is
              > protected by network password.
              > How to pass user name and password when I use openConnection method? In java
              > doc, this method looks like do not accept these two parameters.
              >
              > Thanks
              >
              > ----- my code in applet ---------
              > URL url = new URL("http://127.0.0.1/xml/index.cfm");
              > URLConnection connection = url.openConnection();
              > connection.setDoInput(true);
              > connection.setDoOutput(true);
              > connection.setUseCaches(false);
              > connection.setAllowUserInteraction(false);
              > DataOutputStream dos = new DataOutputStream(connection.getOutputStream());
              > dos.writeBytes("POST " + path + " HTTP/1.0\r\n");
              > dos.writeBytes("Referer: http://127.0.0.1/XML/index.cfm\r\n");
              > dos.writeBytes("Content-Type:
              > multipart/form-data;boundary=---------------------------7d0b414b04\r\n");
              > dos.writeBytes("Host: "+host+":"+port+"\r\n");
              > dos.writeBytes("Content-Length:" + buff.length()+"\r\n");
              > dos.writeBytes("Connection: Keep-Alive\r\n\n");
              > dos.writeBytes("-----------------------------7d0b414b04\r\nContent-Dispositi
              > on: form-data;name=\"xmlDoc\"\r\n\r\n");
              > dos.writeBytes(buff.toString());
              > dos.writeBytes("\r\n-----------------------------7d0b414b04--\r\n");
              > dos.close();
              >
              > ------------------------------------------
              

  • How to pass tag name and value dynamically in the output of PCo notification?

    Hi,
    I have a requirement to develop such a scenario where there can be multiple no of tags in PCo (Say 10) but there will be single notification to push the tag name when the value got changed and the changed value to MII. for any value change for any of the tag, the notification will be trigger. So As per my knowledge I have to pass the tag name and value dynamically in the "output" tab of the notification. But need your support to find out how to pass them dynamically.
    Thanks in advance.
    Regards,
    Suman

    Hi Suman/Jeedesh,
    As per Pco notification, it will trigger whenever any of the tag value changes in Agent instance subscription items.
    For above issue, My suggestion
    1. Create DB table name TAGLIST with 200 tags as rows in columns (Tagname, TagValue)
    2. Based on notification trigger, create a transaction and update values w.r.t TagNames in above table
    3. Next time, when notification trigger with fresh value for any of the tag, cross check with existing TagName with Value and update in DB table.
    4. And in the mean time, send those Tag details vie mail trigger or as per requirement
    Instead of creating 200 notification, above is a just alternate way suggestion to achieve dynamic tag value change notification.
    Hope it might solve your problem
    Regards,
    Praveen Reddy

  • How to pass login name and password

    Hi all,
    If this question has been asked before, please let me know, and I am sorry for duplicate the question raising.
    I want to use the login name and password which are entered from the left frame(topic frame) in the right frame ( the content frame).
    I have 3 jsp programs, "A.jsp" is for validate the login (name and password), "B.jsp" contains a form-submit to add the records to a database. "C.jsp" is the actual one which does the updating to the database.
    Q1, how can I re-use the login name and password for "B.jsp" and "C.jsp"?
    Q2, is there any security problem to do so?
    your useful reply will give me a great help.
    ths

    or try here:
    http://forum.java.sun.com/thread.jsp?forum=31&thread=308840
    http://forum.java.sun.com/thread.jsp?forum=31&thread=295349

  • Pass image name and path to flash from html

    Hello Flash Forum,
    I would like to use Flash to display a larger image in an
    HTML page that opens on top of a window with
    thumbnail images. The thumbnail page will be a php page. If
    the user clicks the thumbnail, I would like to open a swf that
    diplays the larger image. I would like to pass the path and name of
    the image to display to my swf. It would open a browser page (or
    just a swf file) over the thumbnail page. The use could then close
    the larger image display, and click another thumbnail, etc.
    How could I do this? I have a swf file that will display the
    image, but I would like to pass the image name from outside the swf
    file.
    Thanks for any tips,
    eholz1

    Hello jpsoul,
    Thanks for the suggestion. I did see some info on the query
    string aspect. I will take a look at the JavaScript
    external.ExternalInterface class as well.
    Thanks again,
    eholz1

  • Question about pass file name and path to file write adapter

    I need to pass file name and path to file adapter for write. I got partial answers from thread Re: Get File name using File Adapter , but seems InboundHeader_msg or outboundHeader_msg only takes file name, how do I pass file directory?
    since I still have to specify file format (like xxx_%xx%.txt) in the file adapter wizard. Will this name conflict with what the name defined in InboundHeader_msg ?
    Similarly, how can I pass a file name and path to a file synchread adapter?
    Thanks,
    Message was edited by:
    user531689

    Just overwrite the filename in the WSDL file that was generated

  • File name and path should be passed as parameter

    hi all,
    i am writing a set of statements into the text file. But i have to pass the file name and also path as a user enterable parameter.
    please suggest me to proceed further.
    for ex: i am storing it as
    output:=text_io.fopen(c:abc\def\out.txt','w');
    right now i am giving like this and storing the data, but now i have to allow file name and path as user parameter.
    please suggest me.
    Thanks..

    Hi,
    for ex: i am storing it as
    output:=text_io.fopen(c:abc\def\out.txt','w');
    right now i am giving like this and storing the data, but now i have to allow file name and path as user parameter.
    please suggest me.Well, how hard can it be?
    You have to get those two parameters from your application into two variables, say "v_filename" and "v_pathname", and then create the file just the same way using the variables to construct the full path :
    output:=text_io.fopen(v_pathname || '\' || v_filename,'w');

  • How to change the default password file's name and path when the database created?

    how to change the default password file's name and path when the database created?
    null

    Usage: orapwd file=<fname> password=<password> entries=<users>
    where
    file - name of password file (mand),
    password - password for SYS and INTERNAL (mand),
    entries - maximum number of distinct DBA and OPERs (opt),
    There are no spaces around the equal-to (=) character.

  • How to print the report file name and path and the last mod date

    Good morning,
    I am trying to print on the footer of the report the report file name and path as well as the report last modification date.
    Anyone would know how I can do that? I have checked the doc but found nothing.
    Thks. Philippe.

    Did you ever determine how to print report name and report last mod date?
    Thanks

  • To pass file name and path as a parameter

    hi all,
    I am using forms6i. I am writing some records into the .txt file. Now i am writing as
    output := text_io.fopen('C:\users\filename.txt','w');
    but i have pass this file name and path also to the parameter(user has to mention the file name and path(if they want).
    please give some suggestion on this parameter.
    Thanks..

    Hi,
    So to select the directory, in the WHNE-BUTTON-PRESSED trigger write,
         :<block_name>.<path_item_name> := GET_FILE_NAME(' ', NULL, NULL, 'Choose any directory.', OPEN_FILE, FALSE);
         IF SUBSTR(:<block_name>.<path_item_name>, LENGTH(:<block_name>.<path_item_name>)) != '/' AND SUBSTR(:<block_name>.<path_item_name>, LENGTH(:<block_name>.<path_item_name>)) != '\' THEN
              :<block_name>.<path_item_name> := :<block_name>.<path_item_name> || '\';
         END IF;and to open the file, write,
    DECLARE
      FT_File  TEXT_IO.FILE_TYPE;
    BEGIN
      IF SUBSTR(:<block_name>.<path_item_name>, LENGTH(:<block_name>.<path_item_name>)) = '/' OR SUBSTR(:<block_name>.<path_item_name>, LENGTH(:<block_name>.<path_item_name>)) = '\' OR :<block_name>.<path_item_name> IS NULL THEN
           MESSAGE('Please Enter file name before continue');
           MESSAGE('Please Enter file name before continue');
           RAISE FORM_TRIGGER_FAILURE;
      END IF;
      FT_File := TEXT_IO.FOPEN(:<block_name>.<path_item_name>, 'w');
    END;Regards,
    Manu.
    If my response or the response of another was helpful or Correct, please mark it accordingly

  • XI Sender file adapter - How to process data and control files.

    Hello all,
       I have the following requirement to fulfill: I am using an FTP client (XI Sender file adapter) to retrieve data from an FTP site. To make sure I am not picking up a data file that is currently being written to, 2 files are actually present on the FTP site (for each data file):
    1. abc.ctrl (control file with no data in it. Indicates that the data file has been completely written).
    2. abc.dat (actual data file).
      I want the file/ftp connector in XI to retrieve the data file (abc.dat) only if the control file (abc.ctrl) is present. After the processing of the data file is finished, both files (.dat and .ctrl) should be deleted.
      Is there an elegant and robust way to accomplish this?
    Thanks for your help.

    Hi Yves,
    in my opinion there's no problem with files currently being written in combination with a polling file adapter because the final file name should be available only when the file is transferred completely. I'm using different file sender adapters very often and never had any problems. After picking up the files I move them to the corresponding archive folders mentioned in the adapters so that a second processing cannot occur.
    Regards
    Ralph

  • How to write step name and playback time to an output file?

    In OpenScript for Functional Test, I want to create a csv file with just the step name and the playback time for the step. I don't care to carry all the details in my report file. I see that in the Session folder, there is a csv file with all the playback results. How can I either customize this csv file or create another csv file to report only the step name and the play back time for each iteration?

    Hi
    That line of code should do the trick:
         utilities.getFileService().appendStringToFile("pathToFile", getStepResult().getStepName()+ "," +getStepResult().getFinishTime() +"\n");Hope this helps
    Alex

  • How to find PG.xml file name and path associated with a FUNCTION

    Hi,
    I am having a function:IRC_VIS_HOME_PAGE with Web HTML value as below:
    OA.jsp?akRegionCode=IRC_VIS_HOME_PAGE&akRegionApplicationId=800&OAPB=IRC_BRAND
    How to find PG.xml file name and path assoicated with above funtion.
    Thanks,
    ashok

    Ashok,
    Function IRC_VIS_HOME_PAGE will have 2 parameter defined for it which are OASF and OAHP where
    OASF=<SelectedFunctionName> - this tells the Framework to select this function in the given "Home Page" menu context.
    OAHP=<HomePageMenuName> - this is used ONLY with the OASF parameter, and it is used to establish the current menu context. It should point to a "Home Page" menu.
    --Shiv                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • How do I put the file name and path into either the header or the footer?

    I need to keep track of pdf documents as their names or locations sometimes change.  I need to show both file name and path, preferably in the header.  I would also like it to refresh automatically when I change, say, the file name, but that's not as essential as the basic function of showing the file name and path.

    You will need to do this with a text field and a Javascript that executes on open.

  • Target Data File Name and Path

    Hi,
    I'm trying to deploy a mapping that writes data into a file, but I need to dynamically set the name and the directory where I want to write this file. The only workaround I found was manually change the pl/sql generated code and change the values in the FOPEN call with a parameter, but this is no what I really want to do. Does anyone know how to tell WB not to hardcode the file name and path?
    I really appreciate you time,
    thanks in advance,
    Matias

    Carla,
    Unfortunately our releases do not go that fast...
    What you could do as an intermediate solution (this is what I would do) is create your mapping and load into a staging table (this can happen in set-based mode so would be fast). In a post mapping process you manually write to the flat file by making the calls to FOPEN etc. by selecting from the staging table. The post mapping process can have an input parameter that you dynamically pass (i.e. via a mapping parameter) and set the file name.
    Mark.

Maybe you are looking for

  • HP LaserJet 200 colorMFP M276nw-Can't print custom sized paper

    HP LaserJet 200 colorMFP M276nw I'm trying to print on a custom page Size (95mm x 171mm) but it starts printing about a third way down the page so the whole text insint printed. I adjusted the paper tray to the right size, canged the page size to my

  • CCMS ALERT--- /SAPAPO/DELETE_LC_ANCHORS

    Dear Experts, How to resolve the CCMS alert for the /SAPAPO/DELETE_LC_ANCHORS which says as 'Not configured'. Regards, KK

  • Adobe illustrator crashes right after I Close the tutroial window!!  Help!

    Adobe illustrator crashes right after I close the tutroial window!!  Help! I just purchased illustrator after my trial period. It wont run!  And have resinstalled several times. Cleared my font cache.  cleaned my registry. Tried logging as a difffere

  • Camera Raw Cache Files

    Wondering if there is any guidance on retention of .dat files in the folder called User\Local Settings\Application Data\CameraRaw\Cache. I have close to 1 GB of .dat files in that folder, and am looking for ways to keep down the storage in my O/S (bo

  • What can affect the size of a front panel object between versions of Windows?

    Greetings, all! I have a client that wants to use a piece of LabVIEW code on Windows XP, Vista, and 7.  The application was originally written to run on XP machines, so everything looks OK there.  However, on Vista or 7, certain front panel objects a