cancel
Showing results for 
Search instead for 
Did you mean: 

Variable Substitution File Receiver Adapter

Former Member
0 Kudos

Hi,

I am in the process of implementing a scenario involving the conversion of a .jpg file to .bmp. In my scenario, I'd like to the .bmp file name to be dynamically controlled; therefore, I have used the Variable Substitution option in the File Receiver Adapter.

In both the File Sender & Receiver comm. channels, I have ticked 'Adapter Specific Messsage Attributes' check-box and selected the 'File Name' option.

The File Receiver comm. channel also has the following:

File Name Scheme*: %File_Name%.bmp

Variable Name: File_Name

Reference: message:FileName

Having done the above, I am getting the following error message in Comm. Channel Monitoring:

Message processing failed. Cause: com.sap.aii.af.ra.ms.api.RecoverableException: Error during variable substitution: com.sap.aii.adapter.file.varsubst.VariableDataSourceException: Unknown message header category 'FileName' for variable 'File_Name'.: com.sap.aii.adapter.file.configuration.DynamicConfigurationException: Error during variable substitution: com.sap.aii.adapter.file.varsubst.VariableDataSourceException: Unknown message header category 'FileName' for variable 'File_Name'.

Would really appreciate your assistance on this.

Regards,

Reuben.

PS: The Sender File Adapter has the

Accepted Solutions (0)

Answers (6)

Answers (6)

Former Member
0 Kudos

hi,

>>Reference: message:FileName

instead of Filename in the above statement, give any one of below haeder Elements mentioned by me,

1) Variables can refer to attributes of message header, by adding the prefix message:

The message header attribute supported are,

sender_party

sender_service

receiver_party

receiver_service

interface_name

interface_namespace

message_id

message_id_hex

hope it works,

Thanks,

Madhav

Note:Points If Useful

Former Member
0 Kudos

hi reuben

File Name Scheme*: %File_Name%.bmp

Variable Name: File_Name

Reference: message:FileName

here if you are using the reference as message then the variable here refers to the message header attributes like interface_name ...etc

here if the message attributes contains any special characters,replace it with underscore

regards

kummari

Former Member
0 Kudos

Thanks Kummari. The message attributes are exactly as I've explained. So no 'special' characters.

santhosh_kumarv
Active Contributor
0 Kudos

Hi,

>>Reference: message:FileName

You can't refer to the FleName as specified. Only the following attributes of message header can be refered.

sender_party

sender_service

receiver_party

receiver_service

interface_name

interface_namespace

message_id

message_id_hex

If you want to refer to the filename you can assign the filename value to a XML element and refer to it as payload:<elementname><occurance>

Instead you can set the filename using Dynamic Configuration in UDF. Refer my Wiki [More with the File Adapter|https://wiki.sdn.sap.com/wiki/display/XI/MorewiththeFileAdapter] Scenario #2.

Thanks

SaNv...

Former Member
0 Kudos

Hi Santhosh,

Thanks for the suggestion. Having implemented the same dynamic config. UDF using your code, I am getting the following error in the message mapping test editor:

RuntimeException in Message-Mapping transformation: Runtime exception during processing target field mapping /ns0:MaterialBITMAP_In. The message is: Exception:[java.lang.NullPointerException] in class com.sap.xi.tf._Test_Conversion_method setfilename$[17092008, osinef, com.sap.aii.mappingtool.tf3.rt.Context@d3b0d3b].

Any ideas?

Former Member
0 Kudos

Hi,

The full error message is s follows:

Runtime exception during processing target field mapping /ns0:MaterialBITMAP_In. The message is: Exception:[java.lang.NullPointerException] in class com.sap.xi.tf._Test_Conversion_ method setfilename$[17092008, osinef, com.sap.aii.mappingtool.tf3.rt.Context@d3b0d3b] com.sap.aii.mappingtool.tf3.MessageMappingException: Runtime exception during processing target field mapping /ns0:MaterialBITMAP_In. The message is: Exception:[java.lang.NullPointerException] in class com.sap.xi.tf._Test_Conversion_ method setfilename$[17092008, osinef, com.sap.aii.mappingtool.tf3.rt.Context@d3b0d3b] at com.sap.aii.mappingtool.tf3.AMappingProgram.processNode(AMappingProgram.java:350) at com.sap.aii.mappingtool.tf3.AMappingProgram.start(AMappingProgram.java:401) at com.sap.aii.mappingtool.tf3.Transformer.start(Transformer.java:142) at com.sap.aii.mappingtool.tf3.AMappingProgram.execute(AMappingProgram.java:105) at com.sap.aii.ibrep.server.mapping.ServerMapService.transformInternal(ServerMapService.java:431) at com.sap.aii.ibrep.server.mapping.ServerMapService.execute(ServerMapService.java:169) at com.sap.aii.ibrep.sbeans.mapping.MapServiceBean.execute(MapServiceBean.java:52) at com.sap.aii.ibrep.sbeans.mapping.MapServiceRemoteObjectImpl0_0.execute(MapServiceRemoteObjectImpl0_0.java:301) at com.sap.aii.ibrep.sbeans.mapping.MapServiceRemoteObjectImpl0_0p4_Skel.dispatch(MapServiceRemoteObjectImpl0_0p4_Skel.java:146) at com.sap.engine.services.rmi_p4.DispatchImpl._runInternal(DispatchImpl.java:312) at com.sap.engine.services.rmi_p4.DispatchImpl._run(DispatchImpl.java:199) at com.sap.engine.services.rmi_p4.server.P4SessionProcessor.request(P4SessionProcessor.java:129) at com.sap.engine.core.service630.context.cluster.session.ApplicationSessionMessageListener.process(ApplicationSessionMessageListener.java:33) at com.sap.engine.core.cluster.impl6.session.MessageRunner.run(MessageRunner.java:41) at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37) at java.security.AccessController.doPrivileged(AccessController.java:215) at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:100) at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:170) Root Cause: com.sap.aii.utilxi.misc.api.BaseRuntimeException: Exception:[java.lang.NullPointerException] in class com.sap.xi.tf._Test_Conversion_ method setfilename$[17092008, osinef, com.sap.aii.mappingtool.tf3.rt.Context@d3b0d3b] at com.sap.aii.mappingtool.tf3.rt.FunctionWrapper.getValue(FunctionWrapper.java:56) at com.sap.aii.mappingtool.tf3.AMappingProgram.processNode(AMappingProgram.java:294) at com.sap.aii.mappingtool.tf3.AMappingProgram.start(AMappingProgram.java:401) at com.sap.aii.mappingtool.tf3.Transformer.start(Transformer.java:142) at com.sap.aii.mappingtool.tf3.AMappingProgram.execute(AMappingProgram.java:105) at com.sap.aii.ibrep.server.mapping.ServerMapService.transformInternal(ServerMapService.java:431) at com.sap.aii.ibrep.server.mapping.ServerMapService.execute(ServerMapService.java:169) at com.sap.aii.ibrep.sbeans.mapping.MapServiceBean.execute(MapServiceBean.java:52) at com.sap.aii.ibrep.sbeans.mapping.MapServiceRemoteObjectImpl0_0.execute(MapServiceRemoteObjectImpl0_0.java:301) at com.sap.aii.ibrep.sbeans.mapping.MapServiceRemoteObjectImpl0_0p4_Skel.dispatch(MapServiceRemoteObjectImpl0_0p4_Skel.java:146) at com.sap.engine.services.rmi_p4.DispatchImpl._runInternal(DispatchImpl.java:312) at com.sap.engine.services.rmi_p4.DispatchImpl._run(DispatchImpl.java:199) at com.sap.engine.services.rmi_p4.server.P4SessionProcessor.request(P4SessionProcessor.java:129) at com.sap.engine.core.service630.context.cluster.session.ApplicationSessionMessageListener.process(ApplicationSessionMessageListener.java:33) at com.sap.engine.core.cluster.impl6.session.MessageRunner.run(MessageRunner.java:41) at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37) at java.security.AccessController.doPrivileged(AccessController.java:215) at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:100) at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:170) Root Cause: java.lang.reflect.InvocationTargetException at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:85) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:58) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:60) at java.lang.reflect.Method.invoke(Method.java:391) at com.sap.aii.mappingtool.tf3.rt.FunctionWrapper.getValue(FunctionWrapper.java:47) at com.sap.aii.mappingtool.tf3.AMappingProgram.processNode(AMappingProgram.java:294) at com.sap.aii.mappingtool.tf3.AMappingProgram.start(AMappingProgram.java:401) at com.sap.aii.mappingtool.tf3.Transformer.start(Transformer.java:142) at com.sap.aii.mappingtool.tf3.AMappingProgram.execute(AMappingProgram.java:105) at com.sap.aii.ibrep.server.mapping.ServerMapService.transformInternal(ServerMapService.java:431) at com.sap.aii.ibrep.server.mapping.ServerMapService.execute(ServerMapService.java:169) at com.sap.aii.ibrep.sbeans.mapping.MapServiceBean.execute(MapServiceBean.java:52) at com.sap.aii.ibrep.sbeans.mapping.MapServiceRemoteObjectImpl0_0.execute(MapServiceRemoteObjectImpl0_0.java:301) at com.sap.aii.ibrep.sbeans.mapping.MapServiceRemoteObjectImpl0_0p4_Skel.dispatch(MapServiceRemoteObjectImpl0_0p4_Skel.java:146) at com.sap.engine.services.rmi_p4.DispatchImpl._runInternal(DispatchImpl.java:312) at com.sap.engine.services.rmi_p4.DispatchImpl._run(DispatchImpl.java:199) at com.sap.engine.services.rmi_p4.server.P4SessionProcessor.request(P4SessionProcessor.java:129) at com.sap.engine.core.service630.context.cluster.session.ApplicationSessionMessageListener.process(ApplicationSessionMessageListener.java:33) at com.sap.engine.core.cluster.impl6.session.MessageRunner.run(MessageRunner.java:41) at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37) at java.security.AccessController.doPrivileged(AccessController.java:215) at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:100) at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:170) Caused by: java.lang.NullPointerException at com.sap.xi.tf._Test_Conversion_.setfilename$(_Test_Conversion_.java:61) ... 24 more RuntimeException in Message-Mapping transformation: Runtime exception during processing target field mapping /ns0:MaterialBITMAP_In. The message is: Exception:[java.lang.NullPointerException] in class com.sap.xi.tf._Test_Conversion_ method setfilename$[17092008, osinef, com.sap.aii.mappingtool.tf3.rt.Context@d3b0d3b]

11:15:02 End of test

Reuben.

santhosh_kumarv
Active Contributor
0 Kudos

Hi,

Do not test the UDF in Message Mapping as the source file name can obtained only in runtime.

Test a end-to-end scenario.

Thanks

SaNv...

Former Member
0 Kudos

Hi,

I already did that, but it didn't work. The error message I am getting in SXMB_MONI is:

<SAP:Stack>com.sap.aii.utilxi.misc.api.BaseRuntimeException thrown during application mapping com/sap/xi/tf/_Test_Conversion_: Parsing an empty source. Root element expected!</SAP:Stack>

I believe the reason for this could be that the 'source' referred to is a JPEG and obviously doesn't have the xml structure expected in the pipeline.

Former Member
0 Kudos

hi

In the receiver communication channel find the check box diable security settings,enable this check box and try

regard

kummari

Former Member
0 Kudos

Hi Kummari,

I tried that, but it still doesn't work.

Thanks.

Reuben.

Former Member
0 Kudos

VariableName should always be in small case.

File_Name is not recognized by the system. Use file_name instead.

(This may be a BUG but this is how it works)

Regards,

Siva Maranani

Former Member
0 Kudos

Hi Siva,

Thanks for the suggestion; however, I've already attempted it and it doesn't resolve the problem.

Regards,

Reuben.

Shabarish_Nair
Active Contributor
0 Kudos

Why are you using variable substitution?

use dynamic configuration which is more apt.

Some ref:

http://help.sap.com/saphelp_nw04/helpdata/en/43/03612cdecc6e76e10000000a422035/frameset.htm