我试图通过覆盖IBM文档here和here中描述的本地环境,将用户上下文从SOAPAsyncRequest节点传递到SOAPAsyncResponse节点。
在映射到N 计算节点中(计算模式在 LocalEnvironment和Message 上设置):
SET OutputLocalEnvironment = InputLocalEnvironment;
SET OutputLocalEnvironment.Variables.RequestId = InputLocalEnvironment.Destination.HTTP.RequestIdentifier;
SET OutputLocalEnvironment.Variables.Language = InputRoot.HTTPInputHeader."Accept-Language";
SET OutputLocalEnvironment.Destination.SOAP.Request.UserContext = CAST(ASBITSTREAM(OutputLocalEnvironment.Variables) as BLOB);
在 SetRequestId 计算节点中:
DECLARE UserContext BLOB;
SET UserContext = InputLocalEnvironment.Destination.SOAP.Response.UserContext;
Map to N节点之后LocalEnvironment的调试值:
LocalEnvironment
Destination
HTTP
RequestIdentifier:BLOB:[B@54d21920
RouterList
DestinationData
labelName:CHARACTER:GET
SOAP
Request
UserContext:BLOB:[B@3d098be1
SOAP异步响应N 节点之后的调试值:
LocalEnvironment
SOAP
Response
MessageCorrelId:BLOB:[B@a075817
Destination
RouterList
DestinationData
labelName:CHARACTER:findXYZ
虽然在映射到N节点之后正确设置了LocalEnvironment(参见上面的调试),但UserContext
的值始终为null。
编辑:除了UserContext问题,我的流程正常运行。要回答第一条评论,是的,正确设置了唯一标识符。
答案 0 :(得分:1)
我没有成功传递 Variables 树结构,但我通过连接值并将其存储到BLOB中找到了解决方法。它不是解决它的最简洁的方法,在处理两个以上的对象时,这个解决方案也不容易实现。
在映射到D 计算节点:
SET ConcatenatedContext = 'YourFirstString' || ';' || 'YourSecondString';
SET OutputLocalEnvironment.Destination.SOAP.Request.UserContext = CAST(ConcatenatedContext AS BLOB CCSID 1208);
在 SetRequestId 计算节点:
DECLARE RawValue CHARACTER;
SET RawValue = CAST(InputLocalEnvironment.SOAP.Response.UserContext AS CHARACTER CCSID 1208);
SET FirstString = SUBSTRING(RawValue BEFORE ';');
SET SecondString = SUBSTRING(RawValue AFTER ';');