Skip to Content
0

Map File name to some of the fields in WSDL

Jan 18, 2017 at 07:23 PM

160

avatar image

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.

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

14 Answers

Best Answer
Evgeniy Kolmakov Jan 19, 2017 at 12:52 PM
0

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.

Share
10 |10000 characters needed characters left characters exceeded
Evgeniy Kolmakov Feb 02, 2017 at 07:25 PM
1

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.

Share
10 |10000 characters needed characters left characters exceeded
Anoop Rai Jan 19, 2017 at 05:41 AM
0

Hi,

Are you using File Adapter as a sender?

Regards.

Anoop Rai

Share
10 |10000 characters needed characters left characters exceeded
Anurag Tyagi Jan 19, 2017 at 06:55 AM
0

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.

Share
10 |10000 characters needed characters left characters exceeded
Iñaki Vila Jan 19, 2017 at 08:47 AM
0

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.

Share
10 |10000 characters needed characters left characters exceeded
Anitha Gajula Jan 19, 2017 at 09:53 AM
0

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!!

Share
10 |10000 characters needed characters left characters exceeded
Anitha Gajula Jan 19, 2017 at 02:51 PM
0

Thank you Evgeniy

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

Regards

Anitha

Share
10 |10000 characters needed characters left characters exceeded
Anitha Gajula Jan 24, 2017 at 06:16 PM
0

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

Share
10 |10000 characters needed characters left characters exceeded
Evgeniy Kolmakov Jan 25, 2017 at 08:04 PM
0

Hi Anitha!

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

String time = srcStr.substring(9);

Regards, Evgeniy.

Share
10 |10000 characters needed characters left characters exceeded
Anitha Gajula Jan 30, 2017 at 08:21 PM
0

Thank you Evgeniy for your help.

Share
10 |10000 characters needed characters left characters exceeded