com.atlassian.confluence.content.render.xhtml.migration.exceptions.UnknownMacroMigrationException: The macro 'next_previous_links' is unknown.
Sample 354: Using Inline Ruby Scripts for Mediation
Objective: Script mediators using Ruby (inline Ruby script)
<!-- Using In-lined Ruby scripts for mediation -->
<definitions xmlns="http://ws.apache.org/ns/synapse">
<in>
<script language="rb">
<![CDATA[
require 'rexml/document'
include REXML
newRequest= Document.new '<m:getQuote xmlns:m="http://services.samples/xsd"><m:request><m:symbol>...test...</m:symbol></m:request></m:getQuote>'
newRequest.root.elements[1].elements[1].text = $mc.getPayloadXML().root.elements[1].get_text
$mc.setPayloadXML(newRequest)
]]>
</script>
<send>
<endpoint>
<address uri="http://localhost:9000/services/SimpleStockQuoteService"/>
</endpoint>
</send>
</in>
<out>
<script language="rb">
<![CDATA[
require 'rexml/document'
include REXML
newResponse = Document.new '<m:CheckPriceResponse xmlns:m="http://services.samples/xsd"><m:Code></m:Code><m:Price></m:Price></m:CheckPriceResponse>'
newResponse.root.elements[1].text = $mc.getPayloadXML().root.elements[1].elements[1].get_text
newResponse.root.elements[2].text = $mc.getPayloadXML().root.elements[1].elements[2].get_text
$mc.setPayloadXML(newResponse)
]]>
</script>
<send/>
</out>
</definitions>Prerequisites:
This sample uses Ruby, so first set up Ruby support as described at Configuring the ESB for Script Mediator Support.
Create the above configuration and deploy it in the ESB profile.
Start the Axis2 server and deploy the SimpleStockQuoteService if not already done
This sample is functionally equivalent to Sample 353.
Run the client with
ant stockquote -Daddurl=http://localhost:9000/services/SimpleStockQuoteService -Dtrpurl=http://localhost:8280/ -Dmode=customquoteDatabase Interactions in Mediation (DBLookup / DBReport)
Following database mediators use Derby in a client/server configuration by using the network server. Therefore, to proceed with the following samples, you need a working Derby database server and you have to follow the steps in ESB Sample Setup before going through the samples.