首页 > 解决方案 > wso2 esb 在 xslt 转换后注入很少的值

问题描述

我正在从源表中读取一些值并写入目标表。由于字段的名称和某些值不同,我在 WSO2 ESB 中使用 XSLT 中介。在 xslt 调解器之后,我想向有效负载中注入更多值。说一下我以前存储的一些变量。我不能这样做 xslt 因为这些值在某些变量中。所以下面是我的代码。虚线的代码应该是什么?

<enrich>
                <source clone="true" property="SOURCE_TABLE_PAYLOAD" type="property"/>
                <target type="body"/>
            </enrich>
            <xslt key="gov:/bcogc/transformation/SourcetoTargetTransformation.xslt"/>
            ----------------ADD SOME MORE VALUES HERE to the payload------------------
             <header name="Action" scope="default" value="urn:inserttotargettable"/>
            <call>
                <endpoint key="gov:/endpoints/INSERT_DataService_EP.xml"/>
            </call>

请扔一些灯

标签: wso2wso2esb

解决方案


例如,您可以再次使用丰富的调解器,

<property name="orderID" scope="default" description="orderID">
            <orderID xmlns="">2</orderID>
 </property>
  <enrich>
            <source clone="true" xpath="$ctx:orderID"/>
            <target action="sibling" xpath="//orders"/>
  </enrich>

这里定义了 orderID 属性,所以现在您可以将该属性添加为与来自 XSLT 的请求的同级,因此在丰富后请求将如下所示

<orders>
 <order>
  <price>50.00</price>
  <quantity>500</quantity>
  <symbol>IBM</symbol>
  <comment>REF 10053</comment>
 </order>
 <order>
  <price>18.00</price>
  <quantity>500</quantity>
  <symbol>MSFT</symbol>
  <comment>ref 20088398289</comment>
 </order> 
</orders>
<orderID>2</OrderID>

推荐阅读