Send Filename from j2se FILE Adapter

Hi,
I need store filename from local file to xml element. When I use j2ee adapter there is no problem. I sended Filename to Adapter Metadata and through DynamicConfigurationKey in mapping I write it to element.
My question is: How could i do it in j2se plain adapter? (In our customer there is no way for using j2ee adapter)
Many thanks,
Paul.

hi,
try this
DynamicConfiguration conf = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
//obtengo la Key del FileName
DynamicConfigurationKey keyF = DynamicConfigurationKey.getName();
http://help.sap.com/javadocs/NW04/current/pi/com/sap/aii/mapping/api/DynamicConfigurationKey.html
https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/70c89607-e4d9-2910-7280-f6746e964516
/people/mohammed.zabiulla/blog/2008/03/26/have-you-ever-tried-to-determine-mail-cc-dynamically
Hope it helps
Thanks
Rodrigo
Edited by: Rodrigo Pertierra on Apr 11, 2008 9:31 AM

Similar Messages

  • How to get the filename from J2SE File adapter

    In our project scenario , we are using J2EE and J2SE engine both .J2EE for mapping  and J2SE for Deliveying the message .
    In one senario, routing will be based on the filename .
    J2SE Sender File adapter --- XI Adapter --- XI pipe line
    So the File reaching to XI pipelane via J2SE File adapter--> XI adapter.
    When we are using the dynamic configurator in the XI to get the filename
    we are not able to get the file name  becasue it is coming to XI via
    XI adapter.
    How to get the filename ????Hope I am clear about the problem.

    hi,
    try this
    DynamicConfiguration conf = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
    //obtengo la Key del FileName
    DynamicConfigurationKey keyF = DynamicConfigurationKey.getName();
    http://help.sap.com/javadocs/NW04/current/pi/com/sap/aii/mapping/api/DynamicConfigurationKey.html
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/70c89607-e4d9-2910-7280-f6746e964516
    /people/mohammed.zabiulla/blog/2008/03/26/have-you-ever-tried-to-determine-mail-cc-dynamically
    Hope it helps
    Thanks
    Rodrigo
    Edited by: Rodrigo Pertierra on Apr 11, 2008 9:31 AM

  • Question about J2SE-File-Adapter

    Hallo,
    i would send with the J2SE-File-Adapter a *.CSV to SAP XI.
    The structure in the SAP XI is:
    PlaintMaintenanceMessagetype
    ......Datasource..................string
    ......Data
    ..........item
    ..............EquipmentID.............string
    ..............FunktionalLocation......string
    ..............Data....................string
    ..............Time....................string
    The *.csv File structure is:
    6ATESTDEMOYVES,
    1234,
    Limo,
    20060105,
    122030,
    The configuration of the J2SE-File-Adapter is:
    classname=com.sap.aii.messaging.adapter.ModuleFile2XMB
    version=30
    mode=FILE2XMBWITHROWCONVERSION
    ##File Adapter specific parameters (example, see docu)
    ##file.type=BIN
    file.type=TXT
    file.encoding=UTF-8
    xml.documentName=ns:PlaintMaintenanceMessagetype xmlns:ns="http://doehler.com/sapxi/krausdemosender"
    xml.structureTitle=6ATESTDEMOYVES
    xml.processFieldNames=fromConfiguration
    xml.fieldSeparator=;
    xml.fieldNames=Datasource,EpuipmentID,FunctionalLocation,Data,Time
    But it not runing! Can anybody help me? Are any How to guide to send a *.csv with the J2SE-File-Adapter.
    Thanks laura
    With the XML File it works. But there are ofer 40000 records in the *.csv, and i will not create this in *.xml!
    The structure of the XML.File are:
    <?xml version="1.0" encoding="UTF-8"?>
    <ns:PlaintMaintenanceMessagetype xmlns:ns="http://doehler.com/sapxi/krausdemosender">
      <Datasource>6ATESTDEMOYVES</Datasource>
      <Data>
        <item>
          <EpuipmentID>1234</EpuipmentID>
          <FunctionalLocation>Limo</FunctionalLocation>
          <Data>20060105</Data>
          <Time>122030</Time>
        </item>
        <item>
          <EpuipmentID>1235</EpuipmentID>
          <FunctionalLocation>Bier</FunctionalLocation>
          <Data>20060106</Data>
          <Time>122031</Time>
        </item>
       </Data>
    </ns:PlaintMaintenanceMessagetype>

    Hi Laura,
    You can navigate thru these links to get more information:
    http://help.sap.com/saphelp_nw04/helpdata/en/6f/246b3de666930fe10000000a114084/content.htm
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/e698aa90-0201-0010-7982-b498e02af76b
    Cheers,
    Chandra

  • The same filename from a sender to a receiver file adapter

    Michal has provided us with a brilliant <a href="/people/michal.krawczyk2/blog/2005/11/10/xi-the-same-filename-from-a-sender-to-a-receiver-file-adapter--sp14.  I guess a lot of people have been waiting to do this. However, I have a slightly different scenario. In this case, XI is used as a medium to transfer a PDF file from one directory to another directory. There is not transformation or mapping involved.
    The message is send by File Sender Adapter and received by File Receiver Adapter. Message type is created as a simply type hexBinary. The file is supposed to be picked up as a PDF and received as a PDF, retaining the same file name. As such, the file name is neither stored in the source structure nor the target structure.
    Once the PDF file is transfered into target directory, it should be able to be open by using Acrobat directly without further conversion.
    We might add a file name file into the target structure but would that rendered the PDF non-readable upon being received by the File Receiver Adapter?
    Any feedback is highly appreciated.

    Hi
    >>We might add a file name file into the target structure but would that rendered the PDF non-readable upon being received by the File Receiver Adapter?
    No, adding file name would not hamper the properties. You can name *.pdf or something else.
    For that matter any file pdf, word, .msg format etc can be transferred by this approach. We have tried it.
    Earlier to SP14 you cannot give the same name to outgoing file without writing a Adapter module. But things are easy with SP14.
    Cheers,
    satish

  • The same filename from a sender to a receiver file adapter - SP14

    Hi Expers,
    I Have Gone through the link which is given bu Michal.
    /people/michal.krawczyk2/blog/2005/11/10/xi-the-same-filename-from-a-sender-to-a-receiver-file-adapter--sp14
    Here My Questions are.........
    1.Should we give any file name in the receiver side Adapter in this scenario.?????
    2.How wil be the Sender and Receiver Communication channel Parameters????
      What Are they???????
    Please Clarify me...
    Regards
    Khanna

    Hi Rajesh,
    Is your query related to sending the file name from the source xml document to the reciever file adapter. If so this can be achieved.
    Pls. do the following.
    1. In the mapping program that you are using populate the filename coming from the source into the target root element.
    2.Sender adapters can write adapter-specific attributes to the message header; these can then be evaluated at configuration time
    3. To change the adapter-specific attributes of the message header by using message mappings, you access the required classes of the mapping API by using a mapping runtime constant.
    <b>Note: You donot need to specify any filename in the receiver communication channel.</b>
    To access the classes DynamicConfiguration and DynamicConfigurationKey by using the mapping runtime constant DYNAMIC_CONFIGURATION, use the method getTransformationParameters() of the container object.
    Create an simple user defined function in the mapping and use the following code.
    Imports: com.sap.aii.mapping.api.*;
    Parameter: String filename
    Paramter: String filename;
    filename = fileName + ".DAT";
    DynamicConfiguration conf = (DynamicConfiguration) container
    .getTransformationParameters()
    .get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
    DynamicConfigurationKey key = DynamicConfigurationKey.create( "http://sap.com/xi/XI/System/File", "FileName");
    conf.put(key, filename);
    return filename;
    You donot need to hard code the value of the filename in the file adapter for your interface.
    In SXMB_MONI, when you see the pipeline services you would see that the value of the filename is populated in the message payload.
    Thanks
    Indranil

  • Problem: The same filename from a sender to a receiver file adapter - SP14

    Blog : /people/michal.krawczyk2/blog/2005/11/10/xi-the-same-filename-from-a-sender-to-a-receiver-file-adapter--sp14
    My Problem:
    The thing works for me and i am able to get my input files name as my output file name. But one thing i noticed is that in my target message, the field where i have mapped the code it always returns the value "null" but finally when the file is created i get the required result.
    My input file name is input.txt and i get the same name in my output file too.
    In sxmb_moni if i check DynamicConfiguration link i see the following
    <?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
    - <!-- Response
    -->
    - <sap:DynamicConfiguration xmlns:sap="http://sap.com/xi/XI/Message/30">
    <sap:Record namespace="http://sap.com/xi/XI/System/File" name="SourceFTPHost">10.25.116.98:21</sap:Record>
    <sap:Record namespace="http://sap.com/xi/XI/System/File" name="Directory">/input/test</sap:Record>
    <sap:Record namespace="http://sap.com/xi/XI/System/File" name="SourceFileTimestamp">20060228T112200Z</sap:Record>
    <sap:Record namespace="http://sap.com/xi/XI/System/File" name="FileType">bin</sap:Record>
    <b><sap:Record namespace="http://sap.com/xi/XI/System/File" name="FileName">input.txt</sap:Record></b>
    <sap:Record namespace="http://sap.com/xi/XI/System/File" name="SourceFileSize">770</sap:Record>
    </sap:DynamicConfiguration>
    But when i check my mapped field i see
    <field3>BodyC</field3>
    <keyfield>02</keyfield>
    <field5>BodyE</field5>
    <field6>BodyF</field6>
    </Body>
    - <Trailer>
    <keyfield>03</keyfield>
    <b><field2>null</field2> -> Null value instead of input.txt</b>
    </Trailer>
    </ns0:MT_Putfile>
    The code i have used to map the field2 of the trailer is the following ....
    <i>DynamicConfiguration conf = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
    DynamicConfigurationKey key = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File","FileType");
    String valueOld = conf.get(key);
    return  valueOld;  </i>
    Any clues ?

    Gosh this is spooky
    Anyway i tried with that line of code but it throws me an error during activation ...
    Activation of the change list canceled Check result for Message Mapping mm_IS | http://t-systems.com/Shabarish:  Starting compilation  Source code has syntax error:  /usr/sap/TXT/DVEBMGS00/j2ee/cluster/server0/./temp/classpath_resolver/Map387c7300a9ac11da9d280011256afae8/source/com/sap/xi/tf/_mm_IS_.java:104: cannot resolve symbol symbol : method getTransformationParameters () location: interface com.sap.aii.mappingtool.tf3.rt.GlobalContainer DynamicConfiguration conf = (DynamicConfiguration) container.getGlobalContainer().getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION); ^ 1 error
    The code is :
    DynamicConfiguration conf = (DynamicConfiguration) container.getGlobalContainer().getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
    //DynamicConfigurationKey key = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File","FileName");
    //String valueOld = conf.get(key);
    String valueOld = conf.toString();
    return  valueOld; 
    Thanx Renjith so far .. but i hope this gets resolved (else i will loose my sleep thinkin abt the situation)

  • Acknowledgement from receiver file Adapter with out BPM

    Hi Gurus,
    I am trying to get Acknowledgement from Receiver file Adapter with out Using BPM.
    Here is the scenario. I am sending files from different Sender Adapters. There is only one target that is File Adapter. After each successfull and failure transaction I need an Acknowledgement that needs to trigger another receiver adapter and send the the file name and timestamp to that file.
    Hope this is a complicated scenario. Please help me.
    Thanks,
    Kevin

    from sap note 821267
    6. Acknowledgements
        * Q: Does the File Adapter support acknowledgements?
        * A: You need to distinguish system acknowledgements (indicating that a message has been received by the target system) and application acknowledgements (indicating that the message has been successfully processed by the application on the receiver side).
               The receiver of an XI message will only send an acknowledgement back to the sender if the sender has requested one. However, the File Adapter has no functionality that relies on the receipt of an acknowledgement, so it never requests one.
               On the other hand, if a File Adapter Receiver receives a request to send an acknowledgement, it will do so for a system acknowledgement request. Application acknowledgements are not supported at all as the File Receiver has no way to determine if the written file has been correctly processed by the back-end application, which is what a positive application acknowledgement would imply.
    this means that your requirement is ideally not possible without a BPM

  • J2SE file adapter

    i,
    When I post a XI message via SAP PI 7.10 SP7 integration server to a J2SE adapter engine to a file adapter, then when I use mode "XMB2FILE" in the receiver file adapter configuration on the J2SE Adapter Engine then the XML file is delivered into the appropriate folder with the correct XML format and content (As expected). However when I change the mode to XMB2FILEWITHCONVERSION then message fails in the integration Engine on the PI server.
    With:
    <Trace level="2" type="T">Addressing mode: url</Trace>
      <Trace level="3" type="T">Host = "HOST"</Trace>
      <Trace level="3" type="T">Port = 8111</Trace>
      <Trace level="3" type="T">Transport protocol = HTTP 1.0</Trace>
      <Trace level="3" type="T">Message protocol =</Trace>
      <Trace level="3" type="T">Path = /file/receiver?action=execute&pipelineid=Receiver</Trace>
      <Trace level="2" type="T">Auth mode: basicNonSAP</Trace>
      <Trace level="3" type="T">Conversion of language from char2 to char1</Trace>
      <Trace level="3" type="T">User = rip</Trace>
      <Trace level="3" type="T">Client =</Trace>
      <Trace level="3" type="T">Language =</Trace>
      <Trace level="3" type="T">Creating HTTP-client</Trace>
      <Trace level="3" type="T">HTTP-client: creation finished</Trace>
      <Trace level="3" type="T">Security: Basic authentication</Trace>
      <Trace level="3" type="T">Serializing message object...</Trace>
      <Trace level="3" type="T">HTTP-client: sending http-request...</Trace>
      <Trace level="3" type="T">HTTP-client: request sent</Trace>
      <Trace level="3" type="T">HTTP-client: Receiving http-response...</Trace>
      <Trace level="3" type="T">HTTP-client: response received</Trace>
      <Trace level="3" type="T">HTTP-client: checking status code...</Trace>
      <Trace level="3" type="T">HTTP-client: status code = 500</Trace>
      <Trace level="3" type="T">Deserializing message object...</Trace>
      <Trace level="3" type="System_Error">Error while sending by HTTP (error code: 500, error text: Internal Server Error:java.lang.NullPointerException)</Trace>
      </Trace>
      </Trace>
      <Trace level="3" type="System_Error">Error exception return from pipeline processing!</Trace>
      <Trace level="1" type="T">Persist Message in Retry State</Trace>
    A file is created in the target folder with no content and each time PI retries a new file is created.
    If I look at the J2SE adapter trace file the following error is displayed:
    Apr 3, 2009 3:05:03 PM   ...i.messaging.adapter.XMB2FileProcessor [Thread[Thread-1145,5,main]] Error: Message processing failed with
    java.lang.NullPointerException
         at com.sap.aii.af.sdk.xi.adapter.Conversion.convertXML2Plain(Conversion.java:621)
         at com.sap.aii.messaging.adapter.XMB2FileProcessor.persistFile(ModuleXMB2File.java:1658)
         at com.sap.aii.messaging.adapter.XMB2FileProcessor.onMessage(ModuleXMB2File.java:1346)
         at com.sap.aii.messaging.adapter.ModuleHttpServer$ListenerDetails.onMessage(ModuleHttpServer.java:448)
         at com.sap.aii.af.sdk.xi.net.HTTPRequest.run(ServerHttpImpl.java:437)
    Please can you assist in the resolution of this problem?
    Regards
    Willie Hugo

    Hi Stefan,
    Thank for the prompt reply. I am sending the XI message to a plain J2SE Adapter Engine. As I under stand the process, the XI message XML to flat file conversion will take place in the J2SE Adapter Engine in the File Adapter, configured there. If I under stand correctly we need to deploy a patch to the J2SE Adapter Engine and the note refers to XI 3.00 & 7.00, these Adapter Engines I can only assume is J2EE. Also the scenario described in the note is from csv to XML and not the required XML to CSV.
    Please can you assist further?
    Regards
    Willie Hugo

  • Dynamic Filename on Receiver File Adapter

    Hi,
    I am running XI 3.0 SP 14.
    The scenario is
    SAP R/3 (IDOC) > XI (Receiver File Adapter)> FTP Server
    There is no mapping on the XI side, we just drop the IDOC XML on to the ftp server.
    I would like to configure a dynamic file name on the Receiver File Adapter where if the 'MSATZ' Field
    within the E1EPD04 segment of the IDOC is populated then I would like to send a separate
    Filename than the one specified on the 'File Name Scheme'.
    Has anybody done this or any suggestion how I should go about this please.
    Thank you.
    Warm  Regards,
    Ranjan

    Hi Guys,
    When I tried to create the User defined function as below, I got the Null value for the "StreamTransformationConstants.DYNAMIC_CONFIGURATION" object.
    My code looks like this,(this is part of the debuging code)
    Start
    public String Create(String a,String b,Container container){
    if (container.getTransformationParameters() == null)
    return "conf.null";
    if (container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION) == null)
    return "Dynamic.null";
    return b;
    --End
    On the output I get the value "Dynamic.null". I do not know why the object value is Null.
    Any suggestion pls.
    Thank you.
    Warm Regards,
    Ranjan

  • J2SE File Adapter fails (rcv adapter is STARTED but no messages)

    Hi,
    The J2SE Adapter Engine with a file receiver adapter keeps failing. The symptoms are as follows:
    1. We transfer a large number (20-25K) of files.
    2. At some point, the J2SE adapter stops receiving messages.
        The status on the adapter home page indicates that it is started. Restarting the file receiver adapter doesn't fix the problem.
    We noticed that before the crash the following entries appear in the J2SE Adapter Engine Trace files
    Mar 21, 2010 9:20:26 PM  ...ap.aii.messaging.net.HTTPServer.run() [Thread[Thread-24,5,main]] Info: TCP request received from pxpci.fil-eu.sv.philips.com
    Mar 21, 2010 9:20:32 PM  ...equest, HttpServletResponse response) [Thread[Thread-45969,5,main]] Error: java.lang.NullPointerException
         at com.sap.aii.messaging.adapter.Zone.service(ModuleGUIBrowserEngine.java:1167)
         at com.sap.aii.messaging.adapter.HTTPRequest.run(ModuleGUIBrowserEngine.java:406)
    Mar 21, 2010 9:23:26 PM  ...ap.aii.messaging.net.HTTPServer.run() [Thread[Thread-24,5,main]] Info: TCP request received from pxpci.fil-eu.sv.philips.com
    Mar 21, 2010 9:24:26 PM  ...ap.aii.messaging.net.HTTPServer.run() [Thread[Thread-24,5,main]] Info: TCP request received from pxpci.fil-eu.sv.philips.com
    Mar 21, 2010 9:25:29 PM  ...ap.aii.messaging.net.HTTPServer.run() [Thread[Thread-24,5,main]] Info: TCP request received from pxpci.fil-eu.sv.philips.com
    Mar 21, 2010 9:27:50 PM  ...i.messaging.adapter.HTTPRequest.run() [Thread[Thread-45973,5,main]] Error: java.util.NoSuchElementException
         at java.util.StringTokenizer.nextToken(StringTokenizer.java:332)
         at com.sap.aii.messaging.adapter.HTTPRequest.run(ModuleGUIBrowserEngine.java:368)
    Mar 21, 2010 9:27:53 PM  ...i.messaging.adapter.HTTPRequest.run() [Thread[Thread-45974,5,main]] Error: java.util.NoSuchElementException
         at java.util.StringTokenizer.nextToken(StringTokenizer.java:332)
         at com.sap.aii.messaging.adapter.HTTPRequest.run(ModuleGUIBrowserEngine.java:368)
    Do you know why this happens or how can it be fixed?
    Regards
    Divya

    The error in XI is
    IcmConnInitClientSSL: SapSSLSessionStart failed (-57): SSSLERR_SSL_CONNECT
    There were 22000 entries in the file adapter's ExactlyOnce DAT file.
    The restart of the adapter cleared this but it still does get any messages.
    Restarting the GUIBrowser service doesn't work - it just crashes the admin UI also.

  • J2SE file adapter checkModificationInterval

    Hello,
    We're using a standalone J2SE sender file adapter. This adapter polls at a certain directory. (XML)Files are posted in this directory via ftp. When files that are polled become relatively large >2 MB it occurs that part of the file is already processed when file has not been completely written into the directory. This causes an incomplete XML message to be sent to XI system causing an error message.
    The XML file is processed again when file has been written completely.
    However this should be avoided by using the parameter file.checkModificationInterval however we are not succeeding finding the right value for this parameter in combination with
    file.retryInterval
    file.pollInterval
    file.processingLocked
    Does anybody have a clue.

    Hi Emile
    You can just directly set the parameter to,
    file.checkModificationInterval=some milliseconds value
    The way this works is, the file adapter first reads the file, then it waits for the specified time and checks if there is any change in length. If the file length changes it will repeat the read procedure. Again the process is repeated, and if it finds that there is no change in length, the file is processed. The key here is to try and identify the approximate time interval that can be set.
    cheers
    Sameer

  • Sender communication channel with file adapter

    Hi All,
               Here i am facing some error with the communication channel in which i have used FILE adapter. Here i am using PI 7.0. Here i have configured the communication channel. but i didn't checked the "operating system commands". and i checked the " adapter specific message attributes". i dont know whether i have to check these adapter specific message attributes or not. When i have gone to runtime work bench there i saw in adapter monitoring. there it is not showing any error. but in communication channel monitoring it is showing that it is having  -
      "processing  errors" but i am not getting where will be the error.. Any new ideas will be appreciated.
    Thanks in advance,
    Ramana

    Hi Bhavesh and Aaron,
                  Here i viewed the XMl format of the sender file in the mapping. there i found the difference between the file i am trying to pick up by the adapter and the XML instance of the sender interface in mapping. The difference is there in the message type of the <ns0> tag the file i am trying to send is having one message type and name space, where as the XMl instance is having the other message type and same name space.
                 i think that will the problem in processing my file. i am not sure about it.please any of you confirm that if it is th processing error i am facing or not.
                Thanks for your efforts.
    Regards,
    Ramana.

  • Read file name from Payload (File Adapter)

    Hello experts,
    with Receiver-File Adapter I want to save a specific file. Name is given in the xml payload. I use Variable Substitution.
    My structure is like this:
    <root>
        <elements>
            <name>name1</name>
        </elements>
        <elements>
            <name>name2></name>
        </elements>
    </root>
    File name schema: %file%
    Variable Substitution:
        File Name: file
        Reference: payload:root,1,elements,1,name,1
    With this expression my file adapter creates two files (as recommended), but they have both the name "name1". I want to create n files with n different names, given by one xml structure. How can this task be done? Setting the occurency from "1" to "n" or "*" does not work.
    Thank you very much!
    Ilona Seifert

    Hi,
    Like pointed by you , your source strucutre,
    <root>
        <elements>
            <name>name1</name>
        </elements>
        <elements>
            <name>name2></name>
        </elements>
    </root>
    The target strucuture after mutlimapping will be like,
    My structure is like this:
    <root>
        <elements>
            <name>nameX</name>
        </elements>
       </root>
    Now, using Variable Name substitution, you will have the "name " element at a fixed level  always , <b> payload:root,1,elements,1,name,1</b> and so you Variable Name subsitution will also work fine.
    Hope it clears,
    Regards
    Bhavesh

  • Small problem in sending chinese charaters using file adapter

    Hi,
    Actual scenario is,
    Sender system -> file adapter -> XI -> ABAP Proxy -> Receiver system.
    error is occured when the data reached the XI.
                                                                                    1. The data file contains Chinese characters (Unicode).                                                     
    2. When file adapter reads this file, the data in the payload no longer   
        shows Chinese characters.                                                 
    Can you please help in this regard...
    Thanks,
    Surya.

    Hi,
    Actually i am sending an EXCEL sheet which contains chinese charaters to XI using sender file adapter.
    When file adapter reads this file, the data in the payload no longer shows Chinese characters.
    what i need to do?
    SUrya...

  • Read filenames from jar-file

    Hi,
    I want to read image names in a jar-file directory in a web start application. This used to work in previous versions of jdk,
    but when I use jdk 1.6.0_20 I get this errormessage:
    "http:\server:8080\test\client.jar The filename, directory name, or volume label syntax is incorrect".
    Why doesn´t this work anymore?
    Some of my code looks like this:
         getFiles("images/toolbuttons/val/", ".gif", true);
         public String[] getFiles(String catalog, String fileNameEnd,
             boolean removePath)
              JarFileFinder jarFileFinder = new JarFileFinder();
              String jarFilePath = jarFileFinder.getClassLocation(
                  this.getClass().getName());
              String[] files = null;
              try
                   if (fileNameEnd != null)
                        fileNameEndFilter = new FileNameEndFilter(fileNameEnd);
                   files = getFilesInJar(jarFilePath, fileNameEndFilter, catalog,
                       removePath);
              catch (Exception e)
                   MessageUtil.messageOk(null, this.getClass().getName(), e.getMessage());
              return files;
         private String[] getFilesInJar(String jarFilePath, FilenameFilter filter,
             String catalog, boolean removePath)
             throws Exception
              ZipFile zipFile = new ZipFile(jarFilePath);
              Enumeration e = zipFile.entries();
              String name;
              ZipEntry zipEntry;
              ArrayList filesList = new ArrayList();
              while (e.hasMoreElements())
                   zipEntry = (ZipEntry) e.nextElement();
                   name = zipEntry.getName();
                   if ((filter == null || !filter.accept(null, name)) ||
                       (catalog != null && !name.startsWith(catalog)))
                        continue;
                   if (removePath == true)
                        name = name.substring(name.lastIndexOf("/") + 1);
                   filesList.add(name);
              String[] files = new String[filesList.size()];
              for (int i = 0; i < filesList.size(); i++)
                   String s = (String) filesList.get(i);
                   files[i] = s;
              return files;
    public class JarFileFinder
         public String getClassLocation(String classname)
              try
                   Class clazz = Class.forName(classname);
                   if (clazz == null) return null;
                   URL url =
                       clazz.getProtectionDomain().getCodeSource().getLocation();
                   String location = url.toString();
                   if (location.startsWith("jar"))
                        url = ((JarURLConnection)
                            url.openConnection()).getJarFileURL();
                        location = url.toString();
                   if (location.startsWith("file"))
                        return new File(URLDecoder.decode(url.getFile(), "UTF-8")).getAbsolutePath();
                   else
                        return URLDecoder.decode(url.toString(), "UTF-8");
              catch (Exception e)
                   MessageUtil.messageOk(null, this.getClass().getName(), e.getMessage());
              return null;
    }

    AndrewThompson64 wrote:
    Lisa_R wrote:
    ..I tried to remove the URLDecoder, but the result was the same. I still get:
    "http:\server:8080\test\client.jar The filename, directory name, or volume label syntax is incorrect".Given an URL should use '/' as opposed to '\', and starts with 2 '/' rather than one, it is not surprising that URL was rejected. Strange as it may seem, programming by typing random characters into an editor will rarely, if ever, work to create a working application.Yes, I agre that it´s not that surprising that the URL was rejected (even though the URL work in firefox and IE). But I didn´t write it that way. The code that put the URL together worked fine in previous versions of the jdk.
    >
    ..The reason why I want to read the filenames from the jar instead of including a list of the names is that if you
    want to add an image then all you have to do is include it in the directory.. That is largely irrelevant, since the Jar needs to be freshly built, uploaded by the developer, and downloaded by the client. Since all of that needs to be done for the addition of a single image, you might as well add an Ant task to the build that provides a single file (like I suggested earlier) that lists the resources of interest. It would take less time to write an Ant task, than debug all the hoops the code is currently jumping through(1) in order to get the information of interest.
    If this was the only place were this method was used I would agre with you, but unfortunatelly it´s not. The application dosen´t only read image filenames it also reads class-names.
    1) And even if you got that working, it would be likely that Sun would introduce some change in the next version of Java that breaks it again. My advice is to stop fighting it, and go with the flow.Thats not good of course! But it has been working for a long time, so I think I will try to make it work again....
    Is there someone out there who has done this or knows how to do it I would appreciate some help! :-)

Maybe you are looking for

  • What program do I need to change the resolution of a photo?

    What program do I need to change the resolution of a photo that is currently a low-res .jpg? I previously had photoshop, but it did not transfer to my new Mac Lion - and it is too expensive to repurchase. Curious if there is there an alternative opti

  • Trouble creating a MS Word doc

    I am trying to dynamically create a MSWord document: <cfheader name="Content-Disposition" value="attchment; filename=coordSheet.doc"> <cfcontent type="application/msword"> Text here. It opens word fine, but when I go to save as, it saves as .htm even

  • Does Active Directory Support Non English Languages?

    Hi, I want to know that does Active Directory Support Non English Languages like japanes, Arabian? I think we can have domain name in non english languages also. How active directory handles it. Sandeep Gupta

  • Cannot send photo's from iPhoto by email my server settings are correct

    I cannot send photo's by email or iCloud from iPhoto. My server is Virginmedia, i have spoken to them and they have checked my password and all settings and they are correct. They said it would better for me to contact Apple as something might have c

  • Question about hosting - Flex/Coldfusion

    I'm wanting to use Flex to display Coldfusion info. just went through the tutorial at http://www.adobe.com/devnet/flex/articles/fcf_getting_started_coldfusion_flex_02.html and I got the example to work on my local machine. I was also able to do the s