OSB 替换节点

OSB replace node

我一直在尝试用动作 "Replace" 替换节点,但我不明白,希望有人能帮助我。

我有一个 ErrorHandler,在舞台内部;分配 > 替换 > 回复。

In Assign;
Expression: $body
Variable: faultString

In Replace;
Xpath: .
In Variable: faultString
Expression: $body
Replace node contents

In Reply;
With failure

所以这是我收到的回声,这个;

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:cli="http://www.xxxx.com.mx/xxxx/xxxxxxx">
       <soapenv:Header xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"></soapenv:Header>
       <soapenv:Body>
          <cli:getXXXXXXXXXXXXXXX>
             <Json>{"principal":"principal","secundario":"secundario"}</Json>
          </cli:getXXXXXXXXXXXXXXX>
       </soapenv:Body>
</soapenv:Envelope>

我要更换节点

<Json>{"principal":"principal","secundario":"secundario"}</Json>

与;

<Json>{"otracosa":"otro","final":"final"}</Json>

顺便说一下,当 OSB 没有到达终点并想要替换我所说的内容时,我收到了回声。

非常感谢。

作为理解的一部分,您的问题分为两部分:

  1. 您要替换节点内容
  2. 您收到回声

第1点的解决方法:您想替换节点内容:

如果要替换标签内的数据,请使用 "replace node content" 替换 并提供以下详情: XPath: ./:getXXXXXXXXXXXXXXX/:Json 在变量中:body 表达式:{"otracosa":"otro","final":"final"}

2:You 点的解决方案得到回应:

这是 OSB 的行为,如果没有调用端点,它将给出回显。这将提供没有服务被调用的信息。为避免回声,请确保您的条件有效以执行标注配置。

如果您需要任何进一步的说明,可以在这里提问。

此致

Asutosh

为了替换您想要的内容,请使用此配置:

XPath: ./*:getXXXXXXXXXXXXXXX/Json
In Variable: $body
Expression: <Json>{"otracosa":"otro","final":"final"}</Json>
Replace entire node

另一个选项:

XPath: ./*:getXXXXXXXXXXXXXXX/Json
In Variable: $body
Expression: xs:string('{"otracosa":"otro","final":"final"}')
Replace node contents

一些解释:(用我的话)

Variable: where is the payload you want to replace. The root variable.

XPath: XPath to get the node you want to replace in the variable. In the example "." is the root bariable, "" can be any namespace. (you can also use "cli" instead "" if you define the namespace in the IDE)

Expression: Data you want to put.

Replace entire node/Replace node content: if you want to replace all the content including the tag you get with XPath or just the content inside the tags. I put you two examples to do the same.

关于Echo,可能你没有路由节点,也可能你没有到达终点。响应管道 运行 在单独的线程中,如果没有路由节点,则会创建响应管道的回显。