PO配置中经常遇到需要动态传递接口参数的情况。比如URL携带参数、http header需要传实时获取的token等等,那么在PO配置上需要怎么实现呢?一般使用以下两种方式就可以实现了。
注:url地址需进行url encode,PO默认会进行url encode,如不需要则需进行下图配置:
1.指定参数路径
引用字段在dt结构中的路径表达
2.Adapter Specific Attribute
esr-mm配置的时候将数据抛出,所以需要写一个函数实现
FUNCTION LIBRARY
代码
try{
//Get transformation parameter
//方式1:
//DynamicConfiguration conf = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
//方式2:
Map<String, Object> all = container.getInputHeader().getAll();
DynamicConfiguration conf = (DynamicConfiguration)all.get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
//Define key
DynamicConfigurationKey key1 = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/REST", "headertoken");
//Assign variable
conf.put(key1,var1);
}catch(Exception e){
return "Could not assign!";
}
return null;
MM应用