在此 ESB API 流程中,这个链接在 callou 调解器之后的丰富调解器到底是如何工作的?
How exactly works this enrich mediator chained after a callou mediator in this ESB API flow?
我是 WSO2 的新手,我正在从事一个涉及 ESB[=57] 的 EI 项目=] 和 DSS 组件。
我对 API 流程的这一部分的正确含义有以下疑问:
<?xml version="1.0" encoding="UTF-8"?>
<sequence name="cropNamesSequence" trace="disable" xmlns="http://ws.apache.org/ns/synapse">
<payloadFactory media-type="xml">
<format>
<ds:FindCropNames xmlns:ds="http://ws.wso2.org/dataservice">
<ds:sampleId></ds:sampleId>
</ds:FindCropNames>
</format>
<args>
<arg evaluator="xml" expression="$ctx:sampleData//ds:Sample/ds:sample_id/text()" xmlns:ds="http://ws.wso2.org/dataservice"/>
</args>
</payloadFactory>
<header name="Action" scope="default" value="urn:FindCropNames"/>
<callout endpointKey="prgfasEndpoint">
<source xmlns:ns="http://org.apache.synapse/xsd" xmlns:s11="http://schemas.xmlsoap.org/soap/envelope/" xmlns:s12="http://www.w3.org/2003/05/soap-envelope" xpath="s11:Body/child::*[fn:position()=1] | s12:Body/child::*[fn:position()=1]"/>
<target xmlns:ns="http://org.apache.synapse/xsd" xmlns:s11="http://schemas.xmlsoap.org/soap/envelope/" xmlns:s12="http://www.w3.org/2003/05/soap-envelope" xpath="s11:Body/child::*[fn:position()=1] | s12:Body/child::*[fn:position()=1]"/>
</callout>
<enrich>
<source clone="true" type="envelope"/>
<target property="cropNames" type="property"/>
</enrich>
<log level="custom">
<property expression="$ctx:cropNames" name="crop names"/>
</log>
........................................................................
........................................................................
DO SOMETHING ELSE
........................................................................
........................................................................
在这段代码中,我执行了以下操作:
第一个 payloadFactory 中介器用于创建包含 <ds_sampleId>...</ds_sampleId>
参数的消息,该参数由相关的 XPATH 检索表达式变成了<args>...</args>
。此消息表示我将发送到 DSS 服务的请求。
然后我用 name="Action" 指定 header 指定 DSS 的名称 用于从数据库中获取一些数据的服务(服务名称是 urn:FindCropNames.
然后我使用 callout 中介来执行对先前网络服务的请求。
我的疑惑与下面enrich调解员有关,这个:
<enrich>
<source clone="true" type="envelope"/>
<target property="cropNames" type="property"/>
</enrich>
在许多示例中,我经常看到在使用 callout 调解器调用 Web 服务后,调解器被更改为 enrich 调解器。
根据我的理解,这个特定调解器(在已发布的案例中)的含义是我正在添加 Web 服务响应的 envelope 并将其复制到一个新的 属性 名称 cropNames 然后我可以在我的流程中使用,例如我可以记录这个 属性 链接的内容:
<log level="custom">
<property expression="$ctx:cropNames" name="crop names"/>
</log>
这个解释是正确的还是我遗漏了什么?
这是正确的,创建了一个类型为"OM"(xml)的属性,它的名字是"cropNames"并且属于默认作用域(synapse scope) ),您可以使用这些 xpath 访问它:get-属性('cropNames') 或 $ctx:cropNames
我是 WSO2 的新手,我正在从事一个涉及 ESB[=57] 的 EI 项目=] 和 DSS 组件。
我对 API 流程的这一部分的正确含义有以下疑问:
<?xml version="1.0" encoding="UTF-8"?>
<sequence name="cropNamesSequence" trace="disable" xmlns="http://ws.apache.org/ns/synapse">
<payloadFactory media-type="xml">
<format>
<ds:FindCropNames xmlns:ds="http://ws.wso2.org/dataservice">
<ds:sampleId></ds:sampleId>
</ds:FindCropNames>
</format>
<args>
<arg evaluator="xml" expression="$ctx:sampleData//ds:Sample/ds:sample_id/text()" xmlns:ds="http://ws.wso2.org/dataservice"/>
</args>
</payloadFactory>
<header name="Action" scope="default" value="urn:FindCropNames"/>
<callout endpointKey="prgfasEndpoint">
<source xmlns:ns="http://org.apache.synapse/xsd" xmlns:s11="http://schemas.xmlsoap.org/soap/envelope/" xmlns:s12="http://www.w3.org/2003/05/soap-envelope" xpath="s11:Body/child::*[fn:position()=1] | s12:Body/child::*[fn:position()=1]"/>
<target xmlns:ns="http://org.apache.synapse/xsd" xmlns:s11="http://schemas.xmlsoap.org/soap/envelope/" xmlns:s12="http://www.w3.org/2003/05/soap-envelope" xpath="s11:Body/child::*[fn:position()=1] | s12:Body/child::*[fn:position()=1]"/>
</callout>
<enrich>
<source clone="true" type="envelope"/>
<target property="cropNames" type="property"/>
</enrich>
<log level="custom">
<property expression="$ctx:cropNames" name="crop names"/>
</log>
........................................................................
........................................................................
DO SOMETHING ELSE
........................................................................
........................................................................
在这段代码中,我执行了以下操作:
第一个 payloadFactory 中介器用于创建包含
<ds_sampleId>...</ds_sampleId>
参数的消息,该参数由相关的 XPATH 检索表达式变成了<args>...</args>
。此消息表示我将发送到 DSS 服务的请求。然后我用 name="Action" 指定 header 指定 DSS 的名称 用于从数据库中获取一些数据的服务(服务名称是 urn:FindCropNames.
然后我使用 callout 中介来执行对先前网络服务的请求。
我的疑惑与下面enrich调解员有关,这个:
<enrich>
<source clone="true" type="envelope"/>
<target property="cropNames" type="property"/>
</enrich>
在许多示例中,我经常看到在使用 callout 调解器调用 Web 服务后,调解器被更改为 enrich 调解器。
根据我的理解,这个特定调解器(在已发布的案例中)的含义是我正在添加 Web 服务响应的 envelope 并将其复制到一个新的 属性 名称 cropNames 然后我可以在我的流程中使用,例如我可以记录这个 属性 链接的内容:
<log level="custom">
<property expression="$ctx:cropNames" name="crop names"/>
</log>
这个解释是正确的还是我遗漏了什么?
这是正确的,创建了一个类型为"OM"(xml)的属性,它的名字是"cropNames"并且属于默认作用域(synapse scope) ),您可以使用这些 xpath 访问它:get-属性('cropNames') 或 $ctx:cropNames