[英]Rebuilding the initial message using the payload factory mediator
I'm involved in a proxy service development using WSO2. 我参与了使用WSO2进行代理服务的开发。
In my sequence I've saved the initial current message in a property using the following: 按照我的顺序,我已使用以下命令将当前的初始消息保存在一个属性中:
<property name="InitialMessage" expression="$body" scope="default" type="STRING"/>
and now I need to rebuild the initial message using the payload factory mediator. 现在,我需要使用有效负载工厂中介程序来重建初始消息。 Am I right? 我对吗? What are some considerable alternatives? 有哪些可替代的选择?
Could someone show me the right syntax in this case? 在这种情况下,有人可以告诉我正确的语法吗?
yes your method is correct, But I would suggest you to save only the required properties from your incoming message and use them in building the new message. 是的,您的方法是正确的,但是我建议您仅从传入消息中保存所需的属性,并在构建新消息时使用它们。 Sample Syntax is given below 示例语法如下
<payloadfactory>
<format>
<m:checkpriceresponse xmlns:m="http://services.samples/xsd">
<m:code>$1</m:code>
<m:price>$2</m:price>
</m:checkpriceresponse>
</format>
<args>
<arg expression="//m0:symbol" xmlns:m0="http://services.samples/xsd">
<arg expression="//m0:last" xmlns:m0="http://services.samples/xsd">
</arg></arg></args>
</payloadfactory>
I've solved my problem using the enrich mediator: Here you are how ... 我已经使用丰富的中介程序解决了我的问题:这就是您的方法...
I've saved my initial message in a property InitialMessage in this manner ... 我已经以这种方式将初始消息保存在属性InitialMessage中...
<property name="InitialMessage" expression="$body" scope="default" type="STRING"/>
and after I've used the enrich mediator in this manner 在我以这种方式使用丰富的调解人之后
<enrich>
<source type="property" clone="true" property="InitialMessage"/>
<target type="body"/>
</enrich>
It's working ... 工作正常...
I hope this could be useful ... 我希望这可能是有用的...
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.