简体   繁体   English

如何在wso2 ESB中使用xslt中介器?

[英]How to use xslt mediator in wso2 ESB?

I have a xslt that i have stored in local-entry. 我有一个存储在本地条目中的xslt。 I have response xml saved in a property. 我将响应xml保存在一个属性中。 How can i use xslt mediator that should take the xslt from local-entry and xslt mediator should take xml from property and the result of transformation should get stored in a property. 我如何使用应该从local-entry中获取xslt的xslt介体,而xslt介体应该从属性中获取xml,并且转换结果应该存储在属性中。 How to achieve this? 如何实现呢?

I have achieved the transformation using xslt mediator and i am able to show that data using send mediator but i am wondering, How can i store the transformed data in property ? 我已经使用xslt中介器实现了转换,并且能够使用发送中介器显示该数据,但是我想知道如何将转换后的数据存储在属性中 Badly need a solution in this regard. 在这方面急需解决方案。 please help. 请帮忙。 Looking forward to your answers? 期待您的回答? Thanks in advance 提前致谢

My sequence is: 我的顺序是:

  <sequence>
<property xmlns:ns="http://org.apache.synapse/xsd" name="propertyResponse" expression="$body"/>
<xslt key="TransformResponseXML"/>
             <send/>
    </sequence>

My $body is: 我的$ body是:

<soapenv:Body xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<reg_Collection xmlns="http://tempuri.org">
<Inputs>
<ID>Book_112</ID>
<Description>Name for Registeration of new Books</Description>
</Inputs>
</reg_Collection>
</soapenv:Body>

My final output response is: 我的最终输出响应是:

<InputResponse xmlns="http://tempuri.org">
 <ID>Book_112</ID>
 <Description>Name for Registeration of new Books</Description>
</InputResponse >

Now i am able to show the transformed xml as output. 现在,我能够将转换后的xml显示为输出。 i just want to store this response in Property mediator. 我只想将此回复存储在媒体中介器中。

Another option would be to use enrich mediator to dump the transformed message body to a property. 另一种选择是使用扩展介体将转换后的消息主体转储到属性。 For that, you can use the following configuration snippet just after the XSLT mediator configuration. 为此,您可以在XSLT中介程序配置之后使用以下配置代码段。

<enrich>
   <source type="body"/>
   <target type="property" property="PROPERTY_NAME"/>
</enrich>

NOTE: "PROPERTY_NAME" should be replaced with the name of the property that you would want to dump the message into. 注意:“ PROPERTY_NAME”应替换为要将消息转储到的属性的名称。

Hope this helps! 希望这可以帮助!

Regards, Prabath 问候,Prabath

You can store it using property mediator [1]. 您可以使用属性介体[1]存储它。 give the XPATH operation for the transformed message for the property mediator. 为属性介体提供转换后的消息的XPATH操作。 Use type 'OM' as you are storing XML message extract. 存储XML消息摘录时,请使用类型“ OM”。 (If you need to store the complete body use $body and similary use appropriate XPATH if you need only a part. http://docs.wso2.org/wiki/display/ESB451/Synapse+XPath+Variables#SynapseXPathVariables-body ) (如果你需要存储的完整的身体使用$身体和与之相似采用适当的XPATH如果你只需要一个部分。 http://docs.wso2.org/wiki/display/ESB451/Synapse+XPath+Variables#SynapseXPathVariables-body

[1] http://docs.wso2.org/wiki/display/ESB460/Property+Mediator [1] http://docs.wso2.org/wiki/display/ESB460/Property+Mediator

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM