🚩业务场景
某系统集成场景下,SAP作为发送方需要根据业务类型调用第三方系统接口返回处理结果。
💡需求描述
外围系统提供多个接口给SAP调用,这些接口仅URL有部分Path差异,入参字段等均无差异如下图所示。如何通过一个通用PO配置实现SAP可调用外部多个接口?
🕸️接口信息
接口描述 | 接口类型 | 请求方法 | 接口地址 |
common | REST | POST | http://host:port/dev-api/common/sapBusiness/callback |
batch | REST | POST | http://host:port/dev-api/batch/sapBusiness/callback |
//请求参数
{"djh":"","djh1":"","djh2":"","djh3":"","djh4":"","djh5":"","msg":"","nvcrecid":"","nvctype":"","type":""}
//返回参数:
{"msg":"success","code":200,"data":"","success":true}
PO配置
ESR
配置目录
DT配置
MM配置
public String setPath(String name, String var, Container container) throws StreamTransformationException{
try{
//Get transformation parameter
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", name);
conf.put(key1, var);
}catch(Exception e){
return null;
}
return null;
}