cancel
Showing results for 
Search instead for 
Did you mean: 

Reading Dynamic Configuration information in side adapter module.

Former Member
0 Kudos

Hi All,

We are writing an adapter module for one of our receiver adapter.

On the Sender side we have a file adapter whose adapter specific properties are checked. So the message has the file name in the Dynamic configuration.

Now we need to read this file name from dynamic configuration inside our adapter module for receiver adapter.

If any one can tell us how to do this we would be really thankful.

Thanks

Abinash

Accepted Solutions (0)

Answers (4)

Answers (4)

stefan_grube
Active Contributor
0 Kudos

Starting with SP16 you find following method in Interface Message:

java.lang.String getMessageProperty(java.lang.String namespace, java.lang.String name)

Regards

Stefan

bhavesh_kantilal
Active Contributor
0 Kudos

Hi Abhinash,

https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/6d967fbc-0a01-0010-4fb4-91c...

take a look at this document and check if it has answer to your problem.

Regards,

Bhavesh

moorthy
Active Contributor
0 Kudos

Hi,

<i>Now we need to read this file name from dynamic configuration inside our adapter module for receiver adapter.</i>

>>Do you need to get dynamic file name in the target as the same as input file name. Then refer this blog-

/people/michal.krawczyk2/blog/2005/11/10/xi-the-same-filename-from-a-sender-to-a-receiver-file-adapter--sp14

>>If you want to part of the payload then map it in the mapping.

Using Module-

/people/sap.user72/blog/2005/07/15/copy-a-file-with-same-filename-using-xi

Regards,

Moorthy

Former Member
0 Kudos

Hi All,

My requirement is I need to read the file name from Dynamic configuration in the SOAP header inside my adapter module.

Since we are not going to use mapping we are trying to do it inside the custom adapter module.

Krishna, we don't have the file adapter on the receiver side rather it's an email adapter. We are using a dummy interface to get the file from sender and send the file as attachment to the receiver through Mail adapter. Now for this we need to have the attachment name same as the file name.

Now if you want to use the follwoing code:

DynamicConfiguration conf = (DynamicConfiguration) param.get(

StreamTransformationConstants.DYNAMIC_CONFIGURATION);

Then what should be the corresponding library for this inside adapter framework.

If some one can help us on this I would be really thankful.

Thanks

Abinash

bhavesh_kantilal
Active Contributor
0 Kudos

Hi Abhinash,

You need to have the JAR <b>aii.map.api.jar</b> to access those classes.

You will find this jar in the path <b>j2ee\cluster\server0\apps\sap.com\com.sap.xi.services</b> of your XI server.

Regards,

Bhavesh

Former Member
0 Kudos

Hi Bhavesh,

Thanks for your response. But I have a problem . What should be the type of param in the code

DynamicConfiguration conf = (DynamicConfiguration) param.get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);

Thanks

Abinash

bhavesh_kantilal
Active Contributor
0 Kudos

Hi,

import com.sap.aii.mapping.api.StreamTransformationConstants;

Regards,

Bhavesh

Former Member
0 Kudos

Hi Bhavesh,

But still I am confused from where we will get the object of <b>param</b>.

or

How can we get the cotainer object for doing the following:

DynamicConfiguration conf = (DynamicConfiguration)

container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);

Thanks

Abinash

bhavesh_kantilal
Active Contributor
0 Kudos

Hi Abhinash,

At last I got your Problem.

Sorry for the confusion ,

I missed a declaration in my earlier code,

<b>private Map param;</b>

Hopefully, this answers your question

Regards,

Bhavesh

Former Member
0 Kudos

Bhavesh,

When we use the follwoing code inside mapping

DynamicConfiguration conf = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);

the conf object gets populated

but inside our adapter module we ares using

Map param;

DynamicConfiguration conf = (DynamicConfiguration)

param.get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);

DynamicConfigurationKey key = DynamicConfigurationKey.create

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

String ourSourceFileName = conf.get(key);

Now the question is from where the <b>object of par</b>am will initialize.

I think we need to get container object from some where, but don't know how to get it as inside mapping the container object is passed as method argument.

Thanks

Abinash

bhavesh_kantilal
Active Contributor
0 Kudos

Hi Abhinash,

I didnt think about that.

Can you give it a try and check if it works and if it doesnt, maybe then we have to look at another alternative approach .

Regards,

bhavesh

Former Member
0 Kudos

Hello Bhavesh,

I have already tried that. I am getting <b>Exception caught by adapter framework: null</b>.

So I think someway we have to find out how to acess the SOAP header informations in side a adpter module that will be usred on the reciver side.

I really appriciate your effort and time on this. For this I am giving you some points. Please let me know if you find any solution to this.

bhavesh_kantilal
Active Contributor
0 Kudos

Hi Abhinash,

Maybe you will have to use the Mapping after all and get the FileName into the mapping.

If you are using a FILE to FILE scenario, then no mapping is also needed, just enable the ADAPTER SPECIFIC IDENTIFIERS in both your Sender and Receiver File adapter.

Can you give us more details on what your entire proecess flow is so that maybe an alternative can be looked at?

Regards,

Bhavesh

Former Member
0 Kudos

Bhavesh,

The scenario is quite simple.

We just need to pick the file which can be anything, then we need to deliver this file as an attachment using mail adpter. The attachment name should be the same as file name .

Thanks

Abinash

Former Member
0 Kudos

Before XI executes the execute method it executes the method setParameter(Map arg0)

so in your class should be something like this

public class MyMapping implements StreamTransformation {

private Map map = null;

public void execute(InputStream in, OutputStream out) {

Blah blah blah....

}

public void setParameter(Map arg0) {

this.map = arg0;

}

So when you are in the execute method you already have initializated the map parameter.

Hope it works

Regards.

bhavesh_kantilal
Active Contributor
0 Kudos

Hi,

Try this code,

private Map param;

// access dynamic configuration
      DynamicConfiguration conf = (DynamicConfiguration) param.get( 
          StreamTransformationConstants.DYNAMIC_CONFIGURATION);
 DynamicConfigurationKey KEY_FILENAME = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File","FileName");
 
      // read value
      String Filename = conf.get(KEY_FILENAME);

Regards,

Bhavesh

Message was edited by: Bhavesh Kantilal