Skip to Content
avatar image
Former Member

Map File name to some of the fields in WSDL

Hi All

I need your help on below requirement.

PI version: 7.0

PI to pick pdf file from AL11 and convert to base64 then send to third party using SOAP adapter.

This is achieved successfully through Java mapping.

Now additional requirement is to pass dynamic file name to some of the fields in WSDL.

For example:

File name is 200345666742_67834_1287945090523567_20170117153350.PDF in AL11

Expected Output:

200345666742 - Invoice number

67834 - Merchant ID

1287945090523567 - Card num
20170117 - Date
153350 - Time

Thanks in advance!! Please let me know if you need more information.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

14 Answers

  • Best Answer
    Jan 19, 2017 at 12:52 PM

    Hi Anitha!

    You say that you use java mapping. So why can't you read Dynamic Configuration parameter in your mapping and put results to corresponding payload elements?

    String[] lineParts = line.split("_");

    After that you'll get all of your desired fields, only date/time part should be additionaly splitted with substring() method, for example.

    Regards, Evgeniy.

    Add comment
    10|10000 characters needed characters exceeded

  • Feb 02, 2017 at 07:25 PM

    Hi!

    Did you set parameters in your sender channel to store file name to Dynamic configuration?

    Error message says that your fileName variable is null. It means, that you didn't get its value from Dynamic configuration.

    Regards, Evgeniy.

    Add comment
    10|10000 characters needed characters exceeded

  • Jan 19, 2017 at 05:41 AM

    Hi,

    Are you using File Adapter as a sender?

    Regards.

    Anoop Rai

    Add comment
    10|10000 characters needed characters exceeded

  • Jan 19, 2017 at 06:55 AM

    Hi,

    you can achieve this requirement by UDF

    you can capture file name using adapter specific attribute in udf and return file name as output of the UDF. Then you can use sub-string standard function and other standard functions.

    Add comment
    10|10000 characters needed characters exceeded

  • Jan 19, 2017 at 08:47 AM

    Hi Anitha,

    If i understand rigth your problem, this is that you need to read the filename and later to use it in some filed of you output XML. These links can help you to read the filename:

    https://blogs.sap.com/2005/11/10/xi-the-same-filename-from-a-sender-to-a-receiver-file-adapter-sp14/

    https://wiki.scn.sap.com/wiki/display/XI/Sample+Code+-+Dynamic+Configuration+in+Java+and+ABAP+Mapping

    Later you can use the variable with the filename to set it in your output XML.

    If I am wrong and you can edit the base64 PDF, i think the solution will be more complicated.

    Regards.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jan 19, 2017 at 09:53 AM

    Hi All

    1.Yes I am using File adapter as sender and receiver as SOAP.

    2.Using Java mapping to convert entire PDF file to Base64 and pass to one of the field of wsdl.

    3.In wsdl I have other fields where we need to pass values from File name

    4.No message mapping used to create UDF

    5.With Dynamic configuration I can call file name in Java mapping but my problem is how to split the values in file name and send to fields?

    Please help me out!!

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jan 19, 2017 at 02:51 PM

    Thank you Evgeniy

    I am trying this and will let you know the result.

    Regards

    Anitha

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jan 24, 2017 at 06:16 PM

    Hi Evgeniy

    The code you specified works perfectly.Thank you!!

    Can you please help me for splitting date and time(20170117153350)using substring() method.

    Thanks

    Anitha

    Add comment
    10|10000 characters needed characters exceeded

  • Jan 25, 2017 at 08:04 PM

    Hi Anitha!

    String date=srcStr.substring(0, 9);

    String time = srcStr.substring(9);

    Regards, Evgeniy.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jan 30, 2017 at 08:21 PM

    Thank you Evgeniy for your help.

    Add comment
    10|10000 characters needed characters exceeded