cancel
Showing results for 
Search instead for 
Did you mean: 

To send Dynamic file name using Java mapping

Former Member
0 Kudos

Hi All

We have file to SOAP scenario.

PI will pick the file from Application server and send to third party.

File name will be xxx.aba There is no message mapping and we have java mapping.

Now Dynamic file name should be passed to Target field "fileName"


I have included the below logic in to my java mapping:


private static final DynamicConfigurationKey KEY_FILENAME =

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

and assigned KEY_FILENAME as below:

"<ns0:fileName>" + KEY_FILENAME + "</ns0:fileName>"


I got the output as below:


<ns0:fileName>

         <namespace>http://sap.com/xi/XI/System/File</namespace>

         <name>FileName</name>

     </ns0:fileName>


Required output:


As per wsdl we should send only filName not namespace.


<ns0:fileName>" + xxx.aba + "</ns0:fileName>


Accepted Solutions (1)

Accepted Solutions (1)

former_member186851
Active Contributor
0 Kudos

Hello Anitha,

Try the below code

private static final DynamicConfigurationKey KEY_FILENAME =

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

String FileName = conf.get(KEY_FILENAME);

"<ns0:fileName>" + FileName+ "</ns0:fileName>"

former_member182412
Active Contributor
0 Kudos

Hi Anitha,

Use below code to get the fileName attribute from dynamic configuration.



DynamicConfiguration conf = transformationInput.getDynamicConfiguration();

  DynamicConfigurationKey FILE_NAME_KEY = DynamicConfigurationKey

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

  String fileName = conf.get(FILE_NAME_KEY);

@Ragu the attribute name is FileName not fileName


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

Regards,

Praveen.

former_member186851
Active Contributor
0 Kudos

Ok Praveen..Typo..Thanks for the correction.

@ Anitha

Just use the same with FileName or Praveens code(both are same)..

Answers (2)

Answers (2)

Former Member
0 Kudos

Thank you all for your prompt response.

Hi Raghu

I tried your code but it was throwing error for "conf" as below line was missing.

DynamicConfiguration conf = transformationInput.getDynamicConfiguration();

Hi Praveen

I tried yours it worked perfectly and I can able to see Dynamic File name with out namespace.

Hi Vila

I checked the links... thank you

Closing the Thread

Thank you all

former_member186851
Active Contributor
0 Kudos

Glad to hear Anitha.

I thought you alread added that line.

iaki_vila
Active Contributor
0 Kudos