1
votes

I have a xslt that i have stored in local-entry. I have response xml saved in a property. 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. 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? 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:

<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. i just want to store this response in Property mediator.

2

2 Answers

2
votes

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.

<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.

Hope this helps!

Regards, Prabath

0
votes

You can store it using property mediator [1]. give the XPATH operation for the transformed message for the property mediator. Use type 'OM' as you are storing XML message extract. (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)

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