You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@synapse.apache.org by sh...@apache.org on 2023/05/12 16:09:36 UTC
svn commit: r1909775 [17/34] - in /synapse/site/3_0_2: ./ css/ dev/ fonts/ images/ images/logos/ images/profiles/ img/ js/ userguide/ userguide/samples/ userguide/samples/setup/ userguide/transports/
Added: synapse/site/3_0_2/userguide/samples/sample353.html
URL: http://svn.apache.org/viewvc/synapse/site/3_0_2/userguide/samples/sample353.html?rev=1909775&view=auto
==============================================================================
--- synapse/site/3_0_2/userguide/samples/sample353.html (added)
+++ synapse/site/3_0_2/userguide/samples/sample353.html Fri May 12 16:09:34 2023
@@ -0,0 +1,223 @@
+<!DOCTYPE html>
+<!--
+ | Generated by Apache Maven Doxia Site Renderer 1.7.4 at 2023-05-04
+ | Rendered using Apache Maven Fluido Skin 1.6
+-->
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+ <head>
+ <meta charset="UTF-8" />
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
+ <meta name="Date-Revision-yyyymmdd" content="20230504" />
+ <meta http-equiv="Content-Language" content="en" />
+ <title>Apache Synapse – Apache Synapse - Sample 353</title>
+ <link rel="stylesheet" href="../../css/apache-maven-fluido-1.6.min.css" />
+ <link rel="stylesheet" href="../../css/site.css" />
+ <link rel="stylesheet" href="../../css/print.css" media="print" />
+ <script type="text/javascript" src="../../js/apache-maven-fluido-1.6.min.js"></script>
+ </head>
+ <body class="topBarDisabled">
+ <div class="container-fluid">
+ <div id="banner">
+ <div class="pull-left"><div id="bannerLeft"><h2>Apache Synapse</h2>
+</div>
+</div>
+ <div class="pull-right"></div>
+ <div class="clear"><hr/></div>
+ </div>
+
+ <div id="breadcrumbs">
+ <ul class="breadcrumb">
+ <li id="publishDate">Last Published: 2023-05-04<span class="divider">|</span>
+</li>
+ <li id="projectVersion">Version: 3.0.2</li>
+ </ul>
+ </div>
+ <div class="row-fluid">
+ <div id="leftColumn" class="span2">
+ <div class="well sidebar-nav">
+<ul class="nav nav-list">
+ <li class="nav-header">Main Menu</li>
+ <li><a href="../../index.html" title="Home"><span class="none"></span>Home</a> </li>
+ <li><a href="../../download.html" title="Download"><span class="none"></span>Download</a> </li>
+ <li><a href="../../history.html" title="History"><span class="none"></span>History</a> </li>
+ <li><a href="http://www.apache.org/licenses/LICENSE-2.0" class="externalLink" title="License"><span class="none"></span>License</a> </li>
+ <li><a href="http://www.apache.org/foundation/thanks.html" class="externalLink" title="Thanks"><span class="none"></span>Thanks</a> </li>
+ <li><a href="http://www.apache.org/foundation/sponsorship.html" class="externalLink" title="Sponsorship"><span class="none"></span>Sponsorship</a> </li>
+ <li><a href="http://www.apache.org/security/" class="externalLink" title="Security"><span class="none"></span>Security</a> </li>
+ <li class="nav-header">Documentation</li>
+ <li><a href="../../userguide/installation.html" title="Installation Guide"><span class="none"></span>Installation Guide</a> </li>
+ <li><a href="../../userguide/quick_start.html" title="Quick Start Guide"><span class="none"></span>Quick Start Guide</a> </li>
+ <li><a href="../../userguide/samples/setup/index.html" title="Samples Setup Guide"><span class="none"></span>Samples Setup Guide</a> </li>
+ <li><a href="../../userguide/samples.html" title="Samples Catalog"><span class="none"></span>Samples Catalog</a> </li>
+ <li><a href="../../userguide/config.html" title="Configuration Language"><span class="none"></span>Configuration Language</a> </li>
+ <li><a href="../../userguide/mediators.html" title="Mediators Catalog"><span class="none"></span>Mediators Catalog</a> </li>
+ <li><a href="../../userguide/transports.html" title="Transports Catalog"><span class="none"></span>Transports Catalog</a> </li>
+ <li><a href="../../userguide/properties.html" title="Properties Catalog"><span class="none"></span>Properties Catalog</a> </li>
+ <li><a href="../../userguide/xpath.html" title="XPath functions and Variables"><span class="none"></span>XPath functions and Variables</a> </li>
+ <li><a href="../../userguide/extending.html" title="Extending Synapse"><span class="none"></span>Extending Synapse</a> </li>
+ <li><a href="../../userguide/template_library.html" title="Synapse Template Libraries"><span class="none"></span>Synapse Template Libraries</a> </li>
+ <li><a href="../../userguide/upgrading.html" title="Upgrading"><span class="none"></span>Upgrading</a> </li>
+ <li><a href="../../userguide/deployment.html" title="Deployment"><span class="none"></span>Deployment</a> </li>
+ <li><a href="../../apidocs/" title="Javadocs"><span class="none"></span>Javadocs</a> </li>
+ <li><a href="../../userguide/faq.html" title="FAQ"><span class="none"></span>FAQ</a> </li>
+ <li class="nav-header">Developer Resources</li>
+ <li><a href="../../dev/developer-guide.html" title="Developer Guide"><span class="none"></span>Developer Guide</a> </li>
+ <li><a href="../../dev/best-practices.html" title="Development Best Practices"><span class="none"></span>Development Best Practices</a> </li>
+ <li><a href="../../dev/release-process.html" title="Release Process"><span class="none"></span>Release Process</a> </li>
+ <li class="nav-header">Project Details</li>
+ <li><a href="../../project-info.html" title="Overview"><span class="none"></span>Overview</a> </li>
+ <li><a href="../../mail-lists.html" title="Mailing Lists"><span class="none"></span>Mailing Lists</a> </li>
+ <li><a href="../../source-repository.html" title="Source Repository"><span class="none"></span>Source Repository</a> </li>
+ <li><a href="../../issue-tracking.html" title="Issue Tracking"><span class="none"></span>Issue Tracking</a> </li>
+ <li><a href="../../dependency-management.html" title="Dependencies"><span class="none"></span>Dependencies</a> </li>
+ <li><a href="../../team-list.html" title="Project Team"><span class="none"></span>Project Team</a> </li>
+ </ul>
+ <hr />
+ <div id="poweredBy">
+ <div class="clear"></div>
+ <div class="clear"></div>
+ <div class="clear"></div>
+ <div class="clear"></div>
+ <a href="http://maven.apache.org/" title="Built by Maven" class="poweredBy"><img class="builtBy" alt="Built by Maven" src="../../images/logos/maven-feather.png" /></a>
+ </div>
+ </div>
+ </div>
+ <div id="bodyColumn" class="span10" >
+
+
+ <div class="section">
+<h2><a name="Sample_353:_Using_Ruby_Scripts_for_Mediation"></a>Sample 353: Using Ruby Scripts for Mediation</h2>
+
+<div class="xmlConf"><definitions xmlns="http://ws.apache.org/ns/synapse">
+
+ <localEntry key="stockquoteScript"
+ src="file:repository/conf/sample/resources/script/stockquoteTransform.rb"/>
+
+ <sequence name="main">
+ <in>
+ <!-- transform the custom quote request into a standard quote request expected by the service -->
+ <script language="rb" key="stockquoteScript" function="transformRequest"/>
+
+ <!-- send message to real endpoint referenced by name "stockquote" and stop -->
+ <send>
+ <endpoint name="stockquote">
+ <address uri="http://localhost:9000/services/SimpleStockQuoteService"/>
+ </endpoint>
+ </send>
+ </in>
+ <out>
+ <!-- transform the standard response back into the custom format the client expects -->
+ <script language="rb" key="stockquoteScript" function="transformResponse"/>
+ <send/>
+ </out>
+ </sequence>
+
+</definitions></div>
+
+<p>
+ The external script referenced by the configuration contains the following Ruby
+ scriplet.
+ </p>
+
+<div class="xmlConf"><x><![CDATA[
+require 'rexml/document'
+include REXML
+
+def transformRequest(mc)
+ newRequest= Document.new '<m:getQuote xmlns:m="http://services.samples">'<<
+ '<m:request><m:symbol></m:symbol></m:request></m:getQuote>'
+ newRequest.root.elements[1].elements[1].text = mc.getPayloadXML().root.elements[1].get_text
+ mc.setPayloadXML(newRequest)
+end
+
+def transformResponse(mc)
+ newResponse = Document.new '<m:CheckPriceResponse xmlns:m="http://www.apache-synapse.org/test"><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)
+end
+]]></x></div>
+
+<div class="section">
+<h3><a name="Objective"></a>Objective</h3>
+
+<p>
+ The script mediator of Synapse can be programmed using any BSF compatible
+ programming language. <a href="sample250.html">Sample 250</a> shows how to
+ configure it using JavaScript. This sample shows how to configure the script
+ mediator with Ruby.
+ </p>
+ </div>
+
+<div class="section">
+<h3><a name="Pre-requisites"></a>Pre-requisites</h3>
+
+<p>
+ </p>
+<ul>
+
+<li>
+ This sample uses Ruby so first setup support for this in Synapse as described at
+ <a href="setup/script.html#ruby">Configuring JRuby</a>
+ <br />
+ </li>
+
+<li>
+ Deploy the SimpleStockQuoteService in the sample Axis2 server and start Axis2
+ </li>
+
+<li>
+ Synapse does not ship with a Ruby engine by default. Therefore you should
+ download the Ruby engine from JRuby site and copy the downloaded jar file
+ to the 'lib' directory of Synapse.
+ </li>
+
+<li>
+ Start Synapse using the configuration numbered 353 (repository/conf/sample/synapse_sample_353.xml)
+
+<div class="command">
+ Unix/Linux: sh synapse.sh -sample 353<br />
+ Windows: synapse.bat -sample 353
+ </div>
+ </li>
+ </ul>
+
+ </div>
+
+<div class="section">
+<h3><a name="Executing_the_Client"></a>Executing the Client</h3>
+
+<p>
+ This sample is identical to <a href="sample350.html">sample 350</a> with the
+ only difference being the use of Ruby instead of JavaScript. Use the stock
+ quote client to send a custom quote request as follows.
+ </p>
+
+<div class="command">ant stockquote -Daddurl=http://localhost:9000/services/SimpleStockQuoteService -Dtrpurl=http://localhost:8280/ -Dmode=customquote</div>
+
+<p>
+ The Ruby scriplets will transform the requests and responses as they flow through
+ the service bus.
+ </p>
+ </div>
+ </div>
+
+<p><a href="../samples.html">Back to Catalog</a></p>
+
+
+ </div>
+ </div>
+ </div>
+ <hr/>
+ <footer>
+ <div class="container-fluid">
+ <div class="row-fluid">
+ <p>Copyright ©2005–2023
+<a href="http://www.apache.org/">Apache Software Foundation</a>.
+All rights reserved.</p>
+ </div>
+ </div>
+ </footer>
+ </body>
+</html>
Added: synapse/site/3_0_2/userguide/samples/sample354.html
URL: http://svn.apache.org/viewvc/synapse/site/3_0_2/userguide/samples/sample354.html?rev=1909775&view=auto
==============================================================================
--- synapse/site/3_0_2/userguide/samples/sample354.html (added)
+++ synapse/site/3_0_2/userguide/samples/sample354.html Fri May 12 16:09:34 2023
@@ -0,0 +1,205 @@
+<!DOCTYPE html>
+<!--
+ | Generated by Apache Maven Doxia Site Renderer 1.7.4 at 2023-05-04
+ | Rendered using Apache Maven Fluido Skin 1.6
+-->
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+ <head>
+ <meta charset="UTF-8" />
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
+ <meta name="Date-Revision-yyyymmdd" content="20230504" />
+ <meta http-equiv="Content-Language" content="en" />
+ <title>Apache Synapse – Apache Synapse - Sample 354</title>
+ <link rel="stylesheet" href="../../css/apache-maven-fluido-1.6.min.css" />
+ <link rel="stylesheet" href="../../css/site.css" />
+ <link rel="stylesheet" href="../../css/print.css" media="print" />
+ <script type="text/javascript" src="../../js/apache-maven-fluido-1.6.min.js"></script>
+ </head>
+ <body class="topBarDisabled">
+ <div class="container-fluid">
+ <div id="banner">
+ <div class="pull-left"><div id="bannerLeft"><h2>Apache Synapse</h2>
+</div>
+</div>
+ <div class="pull-right"></div>
+ <div class="clear"><hr/></div>
+ </div>
+
+ <div id="breadcrumbs">
+ <ul class="breadcrumb">
+ <li id="publishDate">Last Published: 2023-05-04<span class="divider">|</span>
+</li>
+ <li id="projectVersion">Version: 3.0.2</li>
+ </ul>
+ </div>
+ <div class="row-fluid">
+ <div id="leftColumn" class="span2">
+ <div class="well sidebar-nav">
+<ul class="nav nav-list">
+ <li class="nav-header">Main Menu</li>
+ <li><a href="../../index.html" title="Home"><span class="none"></span>Home</a> </li>
+ <li><a href="../../download.html" title="Download"><span class="none"></span>Download</a> </li>
+ <li><a href="../../history.html" title="History"><span class="none"></span>History</a> </li>
+ <li><a href="http://www.apache.org/licenses/LICENSE-2.0" class="externalLink" title="License"><span class="none"></span>License</a> </li>
+ <li><a href="http://www.apache.org/foundation/thanks.html" class="externalLink" title="Thanks"><span class="none"></span>Thanks</a> </li>
+ <li><a href="http://www.apache.org/foundation/sponsorship.html" class="externalLink" title="Sponsorship"><span class="none"></span>Sponsorship</a> </li>
+ <li><a href="http://www.apache.org/security/" class="externalLink" title="Security"><span class="none"></span>Security</a> </li>
+ <li class="nav-header">Documentation</li>
+ <li><a href="../../userguide/installation.html" title="Installation Guide"><span class="none"></span>Installation Guide</a> </li>
+ <li><a href="../../userguide/quick_start.html" title="Quick Start Guide"><span class="none"></span>Quick Start Guide</a> </li>
+ <li><a href="../../userguide/samples/setup/index.html" title="Samples Setup Guide"><span class="none"></span>Samples Setup Guide</a> </li>
+ <li><a href="../../userguide/samples.html" title="Samples Catalog"><span class="none"></span>Samples Catalog</a> </li>
+ <li><a href="../../userguide/config.html" title="Configuration Language"><span class="none"></span>Configuration Language</a> </li>
+ <li><a href="../../userguide/mediators.html" title="Mediators Catalog"><span class="none"></span>Mediators Catalog</a> </li>
+ <li><a href="../../userguide/transports.html" title="Transports Catalog"><span class="none"></span>Transports Catalog</a> </li>
+ <li><a href="../../userguide/properties.html" title="Properties Catalog"><span class="none"></span>Properties Catalog</a> </li>
+ <li><a href="../../userguide/xpath.html" title="XPath functions and Variables"><span class="none"></span>XPath functions and Variables</a> </li>
+ <li><a href="../../userguide/extending.html" title="Extending Synapse"><span class="none"></span>Extending Synapse</a> </li>
+ <li><a href="../../userguide/template_library.html" title="Synapse Template Libraries"><span class="none"></span>Synapse Template Libraries</a> </li>
+ <li><a href="../../userguide/upgrading.html" title="Upgrading"><span class="none"></span>Upgrading</a> </li>
+ <li><a href="../../userguide/deployment.html" title="Deployment"><span class="none"></span>Deployment</a> </li>
+ <li><a href="../../apidocs/" title="Javadocs"><span class="none"></span>Javadocs</a> </li>
+ <li><a href="../../userguide/faq.html" title="FAQ"><span class="none"></span>FAQ</a> </li>
+ <li class="nav-header">Developer Resources</li>
+ <li><a href="../../dev/developer-guide.html" title="Developer Guide"><span class="none"></span>Developer Guide</a> </li>
+ <li><a href="../../dev/best-practices.html" title="Development Best Practices"><span class="none"></span>Development Best Practices</a> </li>
+ <li><a href="../../dev/release-process.html" title="Release Process"><span class="none"></span>Release Process</a> </li>
+ <li class="nav-header">Project Details</li>
+ <li><a href="../../project-info.html" title="Overview"><span class="none"></span>Overview</a> </li>
+ <li><a href="../../mail-lists.html" title="Mailing Lists"><span class="none"></span>Mailing Lists</a> </li>
+ <li><a href="../../source-repository.html" title="Source Repository"><span class="none"></span>Source Repository</a> </li>
+ <li><a href="../../issue-tracking.html" title="Issue Tracking"><span class="none"></span>Issue Tracking</a> </li>
+ <li><a href="../../dependency-management.html" title="Dependencies"><span class="none"></span>Dependencies</a> </li>
+ <li><a href="../../team-list.html" title="Project Team"><span class="none"></span>Project Team</a> </li>
+ </ul>
+ <hr />
+ <div id="poweredBy">
+ <div class="clear"></div>
+ <div class="clear"></div>
+ <div class="clear"></div>
+ <div class="clear"></div>
+ <a href="http://maven.apache.org/" title="Built by Maven" class="poweredBy"><img class="builtBy" alt="Built by Maven" src="../../images/logos/maven-feather.png" /></a>
+ </div>
+ </div>
+ </div>
+ <div id="bodyColumn" class="span10" >
+
+
+ <div class="section">
+<h2><a name="Sample_354:_Using_Inline_Ruby_Scripts_for_Mediation"></a>Sample 354: Using Inline Ruby Scripts for Mediation</h2>
+
+<div class="xmlConf"><definitions xmlns="http://ws.apache.org/ns/synapse">
+
+ <sequence name="main">
+ <in>
+ <script language="rb">
+
+ require 'rexml/document'
+ include REXML
+ newRequest= Document.new '<m:getQuote xmlns:m="http://services.samples"><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">
+
+ 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>
+ </sequence>
+
+</definitions></div>
+
+<div class="section">
+<h3><a name="Objective"></a>Objective</h3>
+
+<p>
+ Shows how to embed Ruby scripts in the Synapse configuration itself.
+ </p>
+ </div>
+
+<div class="section">
+<h3><a name="Pre-requisites"></a>Pre-requisites</h3>
+
+<p>
+ </p>
+<ul>
+
+<li>
+ This sample uses Ruby, so first setup support for this in Synapse as described at
+ <a href="setup/script.html#ruby">Configuring JRuby</a>
+ </li>
+
+<li>
+ Deploy the SimpleStockQuoteService in the sample Axis2 server and start Axis2
+ </li>
+
+<li>
+ Synapse does not ship with a Ruby engine by default. Therefore you should
+ download the Ruby engine from JRuby site and copy the downloaded jar file
+ to the 'lib' directory of Synapse.
+ </li>
+
+<li>
+ Start Synapse using the configuration numbered 354 (repository/conf/sample/synapse_sample_354.xml)
+
+<div class="command">
+ Unix/Linux: sh synapse.sh -sample 354<br />
+ Windows: synapse.bat -sample 354
+ </div>
+ </li>
+ </ul>
+
+ </div>
+
+<div class="section">
+<h3><a name="Executing_the_Client"></a>Executing the Client</h3>
+
+<p>
+ Run the sample client as follows.
+ </p>
+
+<div class="command">ant stockquote -Daddurl=http://localhost:9000/services/SimpleStockQuoteService -Dtrpurl=http://localhost:8280/ -Dmode=customquote</div>
+
+<p>
+ The inline Ruby scripts will transform the requests and responses.
+ </p>
+ </div>
+ </div>
+
+<p><a href="../samples.html">Back to Catalog</a></p>
+
+
+ </div>
+ </div>
+ </div>
+ <hr/>
+ <footer>
+ <div class="container-fluid">
+ <div class="row-fluid">
+ <p>Copyright ©2005–2023
+<a href="http://www.apache.org/">Apache Software Foundation</a>.
+All rights reserved.</p>
+ </div>
+ </div>
+ </footer>
+ </body>
+</html>
Added: synapse/site/3_0_2/userguide/samples/sample355.html
URL: http://svn.apache.org/viewvc/synapse/site/3_0_2/userguide/samples/sample355.html?rev=1909775&view=auto
==============================================================================
--- synapse/site/3_0_2/userguide/samples/sample355.html (added)
+++ synapse/site/3_0_2/userguide/samples/sample355.html Fri May 12 16:09:34 2023
@@ -0,0 +1,198 @@
+<!DOCTYPE html>
+<!--
+ | Generated by Apache Maven Doxia Site Renderer 1.7.4 at 2023-05-04
+ | Rendered using Apache Maven Fluido Skin 1.6
+-->
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+ <head>
+ <meta charset="UTF-8" />
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
+ <meta name="Date-Revision-yyyymmdd" content="20230504" />
+ <meta http-equiv="Content-Language" content="en" />
+ <title>Apache Synapse – Apache Synapse - Sample 355</title>
+ <link rel="stylesheet" href="../../css/apache-maven-fluido-1.6.min.css" />
+ <link rel="stylesheet" href="../../css/site.css" />
+ <link rel="stylesheet" href="../../css/print.css" media="print" />
+ <script type="text/javascript" src="../../js/apache-maven-fluido-1.6.min.js"></script>
+ </head>
+ <body class="topBarDisabled">
+ <div class="container-fluid">
+ <div id="banner">
+ <div class="pull-left"><div id="bannerLeft"><h2>Apache Synapse</h2>
+</div>
+</div>
+ <div class="pull-right"></div>
+ <div class="clear"><hr/></div>
+ </div>
+
+ <div id="breadcrumbs">
+ <ul class="breadcrumb">
+ <li id="publishDate">Last Published: 2023-05-04<span class="divider">|</span>
+</li>
+ <li id="projectVersion">Version: 3.0.2</li>
+ </ul>
+ </div>
+ <div class="row-fluid">
+ <div id="leftColumn" class="span2">
+ <div class="well sidebar-nav">
+<ul class="nav nav-list">
+ <li class="nav-header">Main Menu</li>
+ <li><a href="../../index.html" title="Home"><span class="none"></span>Home</a> </li>
+ <li><a href="../../download.html" title="Download"><span class="none"></span>Download</a> </li>
+ <li><a href="../../history.html" title="History"><span class="none"></span>History</a> </li>
+ <li><a href="http://www.apache.org/licenses/LICENSE-2.0" class="externalLink" title="License"><span class="none"></span>License</a> </li>
+ <li><a href="http://www.apache.org/foundation/thanks.html" class="externalLink" title="Thanks"><span class="none"></span>Thanks</a> </li>
+ <li><a href="http://www.apache.org/foundation/sponsorship.html" class="externalLink" title="Sponsorship"><span class="none"></span>Sponsorship</a> </li>
+ <li><a href="http://www.apache.org/security/" class="externalLink" title="Security"><span class="none"></span>Security</a> </li>
+ <li class="nav-header">Documentation</li>
+ <li><a href="../../userguide/installation.html" title="Installation Guide"><span class="none"></span>Installation Guide</a> </li>
+ <li><a href="../../userguide/quick_start.html" title="Quick Start Guide"><span class="none"></span>Quick Start Guide</a> </li>
+ <li><a href="../../userguide/samples/setup/index.html" title="Samples Setup Guide"><span class="none"></span>Samples Setup Guide</a> </li>
+ <li><a href="../../userguide/samples.html" title="Samples Catalog"><span class="none"></span>Samples Catalog</a> </li>
+ <li><a href="../../userguide/config.html" title="Configuration Language"><span class="none"></span>Configuration Language</a> </li>
+ <li><a href="../../userguide/mediators.html" title="Mediators Catalog"><span class="none"></span>Mediators Catalog</a> </li>
+ <li><a href="../../userguide/transports.html" title="Transports Catalog"><span class="none"></span>Transports Catalog</a> </li>
+ <li><a href="../../userguide/properties.html" title="Properties Catalog"><span class="none"></span>Properties Catalog</a> </li>
+ <li><a href="../../userguide/xpath.html" title="XPath functions and Variables"><span class="none"></span>XPath functions and Variables</a> </li>
+ <li><a href="../../userguide/extending.html" title="Extending Synapse"><span class="none"></span>Extending Synapse</a> </li>
+ <li><a href="../../userguide/template_library.html" title="Synapse Template Libraries"><span class="none"></span>Synapse Template Libraries</a> </li>
+ <li><a href="../../userguide/upgrading.html" title="Upgrading"><span class="none"></span>Upgrading</a> </li>
+ <li><a href="../../userguide/deployment.html" title="Deployment"><span class="none"></span>Deployment</a> </li>
+ <li><a href="../../apidocs/" title="Javadocs"><span class="none"></span>Javadocs</a> </li>
+ <li><a href="../../userguide/faq.html" title="FAQ"><span class="none"></span>FAQ</a> </li>
+ <li class="nav-header">Developer Resources</li>
+ <li><a href="../../dev/developer-guide.html" title="Developer Guide"><span class="none"></span>Developer Guide</a> </li>
+ <li><a href="../../dev/best-practices.html" title="Development Best Practices"><span class="none"></span>Development Best Practices</a> </li>
+ <li><a href="../../dev/release-process.html" title="Release Process"><span class="none"></span>Release Process</a> </li>
+ <li class="nav-header">Project Details</li>
+ <li><a href="../../project-info.html" title="Overview"><span class="none"></span>Overview</a> </li>
+ <li><a href="../../mail-lists.html" title="Mailing Lists"><span class="none"></span>Mailing Lists</a> </li>
+ <li><a href="../../source-repository.html" title="Source Repository"><span class="none"></span>Source Repository</a> </li>
+ <li><a href="../../issue-tracking.html" title="Issue Tracking"><span class="none"></span>Issue Tracking</a> </li>
+ <li><a href="../../dependency-management.html" title="Dependencies"><span class="none"></span>Dependencies</a> </li>
+ <li><a href="../../team-list.html" title="Project Team"><span class="none"></span>Project Team</a> </li>
+ </ul>
+ <hr />
+ <div id="poweredBy">
+ <div class="clear"></div>
+ <div class="clear"></div>
+ <div class="clear"></div>
+ <div class="clear"></div>
+ <a href="http://maven.apache.org/" title="Built by Maven" class="poweredBy"><img class="builtBy" alt="Built by Maven" src="../../images/logos/maven-feather.png" /></a>
+ </div>
+ </div>
+ </div>
+ <div id="bodyColumn" class="span10" >
+
+
+ <div class="section">
+<h2><a name="Sample_355:_Using_Python_Scripts_for_Mediation"></a>Sample 355: Using Python Scripts for Mediation</h2>
+
+<div class="xmlConf">
+ <definitions xmlns="http://ws.apache.org/ns/synapse">
+
+ <registry provider="org.apache.synapse.registry.url.SimpleURLRegistry">
+ <!-- the root property of the simple URL registry helps resolve a resource URL as root + key -->
+ <parameter name="root">file:repository/conf/sample/resources/</parameter>
+ <!-- all resources loaded from the URL registry would be cached for this number of milli seconds -->
+ <parameter name="cachableDuration">15000</parameter>
+ </registry>
+
+ <localEntry key="stockquoteScript"
+ src="file:repository/conf/sample/resources/script/stockquoteTransformRequest.py"/>
+
+ <sequence name="main">
+ <in>
+ <!-- transform the custom quote request into a standard quote request expected by the service -->
+ <script language="py" key="stockquoteScript" function="transformRequest"/>
+ <send>
+ <endpoint>
+ <address uri="http://localhost:9000/services/SimpleStockQuoteService"/>
+ </endpoint>
+ </send>
+ </in>
+ <out>
+ <!-- transform the standard response back into the custom format the client expects -->
+ <script language="py" key="script/stockquoteTransformResponse.py"
+ function="transformResponse"/>
+ <send/>
+ </out>
+ </sequence>
+
+ </definitions></div>
+
+<div class="section">
+<h3><a name="Objective"></a>Objective</h3>
+
+<p>
+ Shows how to embed Python scripts in the Synapse configuration itself.
+ </p>
+ </div>
+
+<div class="section">
+<h3><a name="Pre-requisites"></a>Pre-requisites</h3>
+
+<p>
+ </p>
+<ul>
+
+<li>
+ This sample uses Jython, so first setup support for this in Synapse as described at
+ <a href="setup/script.html#python">Configuring Jython</a>
+ </li>
+
+<li>
+ Deploy the SimpleStockQuoteService in the sample Axis2 server and start Axis2
+ </li>
+
+<li>
+ Synapse does not ship with a Jython engine by default. Therefore you should
+ download the Jython engine from Jython site and copy the downloaded jar file
+ to the 'lib' directory of Synapse.
+ </li>
+
+<li>
+ Start Synapse using the configuration numbered 355 (repository/conf/sample/synapse_sample_355.xml)
+
+<div class="command">
+ Unix/Linux: sh synapse.sh -sample 355<br />
+ Windows: synapse.bat -sample 355
+ </div>
+ </li>
+ </ul>
+
+ </div>
+
+<div class="section">
+<h3><a name="Executing_the_Client"></a>Executing the Client</h3>
+
+<p>
+ Run the sample client as follows.
+ </p>
+
+<div class="command">ant stockquote -Daddurl=http://localhost:9000/services/SimpleStockQuoteService -Dtrpurl=http://localhost:8280/ -Dmode=customquote</div>
+
+<p>
+ The Python scripts will transform the requests and responses.
+ </p>
+ </div>
+ </div>
+
+<p><a href="../samples.html">Back to Catalog</a></p>
+
+
+ </div>
+ </div>
+ </div>
+ <hr/>
+ <footer>
+ <div class="container-fluid">
+ <div class="row-fluid">
+ <p>Copyright ©2005–2023
+<a href="http://www.apache.org/">Apache Software Foundation</a>.
+All rights reserved.</p>
+ </div>
+ </div>
+ </footer>
+ </body>
+</html>
Added: synapse/site/3_0_2/userguide/samples/sample360.html
URL: http://svn.apache.org/viewvc/synapse/site/3_0_2/userguide/samples/sample360.html?rev=1909775&view=auto
==============================================================================
--- synapse/site/3_0_2/userguide/samples/sample360.html (added)
+++ synapse/site/3_0_2/userguide/samples/sample360.html Fri May 12 16:09:34 2023
@@ -0,0 +1,299 @@
+<!DOCTYPE html>
+<!--
+ | Generated by Apache Maven Doxia Site Renderer 1.7.4 at 2023-05-04
+ | Rendered using Apache Maven Fluido Skin 1.6
+-->
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+ <head>
+ <meta charset="UTF-8" />
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
+ <meta name="Date-Revision-yyyymmdd" content="20230504" />
+ <meta http-equiv="Content-Language" content="en" />
+ <title>Apache Synapse – Apache Synapse - Sample 360</title>
+ <link rel="stylesheet" href="../../css/apache-maven-fluido-1.6.min.css" />
+ <link rel="stylesheet" href="../../css/site.css" />
+ <link rel="stylesheet" href="../../css/print.css" media="print" />
+ <script type="text/javascript" src="../../js/apache-maven-fluido-1.6.min.js"></script>
+ </head>
+ <body class="topBarDisabled">
+ <div class="container-fluid">
+ <div id="banner">
+ <div class="pull-left"><div id="bannerLeft"><h2>Apache Synapse</h2>
+</div>
+</div>
+ <div class="pull-right"></div>
+ <div class="clear"><hr/></div>
+ </div>
+
+ <div id="breadcrumbs">
+ <ul class="breadcrumb">
+ <li id="publishDate">Last Published: 2023-05-04<span class="divider">|</span>
+</li>
+ <li id="projectVersion">Version: 3.0.2</li>
+ </ul>
+ </div>
+ <div class="row-fluid">
+ <div id="leftColumn" class="span2">
+ <div class="well sidebar-nav">
+<ul class="nav nav-list">
+ <li class="nav-header">Main Menu</li>
+ <li><a href="../../index.html" title="Home"><span class="none"></span>Home</a> </li>
+ <li><a href="../../download.html" title="Download"><span class="none"></span>Download</a> </li>
+ <li><a href="../../history.html" title="History"><span class="none"></span>History</a> </li>
+ <li><a href="http://www.apache.org/licenses/LICENSE-2.0" class="externalLink" title="License"><span class="none"></span>License</a> </li>
+ <li><a href="http://www.apache.org/foundation/thanks.html" class="externalLink" title="Thanks"><span class="none"></span>Thanks</a> </li>
+ <li><a href="http://www.apache.org/foundation/sponsorship.html" class="externalLink" title="Sponsorship"><span class="none"></span>Sponsorship</a> </li>
+ <li><a href="http://www.apache.org/security/" class="externalLink" title="Security"><span class="none"></span>Security</a> </li>
+ <li class="nav-header">Documentation</li>
+ <li><a href="../../userguide/installation.html" title="Installation Guide"><span class="none"></span>Installation Guide</a> </li>
+ <li><a href="../../userguide/quick_start.html" title="Quick Start Guide"><span class="none"></span>Quick Start Guide</a> </li>
+ <li><a href="../../userguide/samples/setup/index.html" title="Samples Setup Guide"><span class="none"></span>Samples Setup Guide</a> </li>
+ <li><a href="../../userguide/samples.html" title="Samples Catalog"><span class="none"></span>Samples Catalog</a> </li>
+ <li><a href="../../userguide/config.html" title="Configuration Language"><span class="none"></span>Configuration Language</a> </li>
+ <li><a href="../../userguide/mediators.html" title="Mediators Catalog"><span class="none"></span>Mediators Catalog</a> </li>
+ <li><a href="../../userguide/transports.html" title="Transports Catalog"><span class="none"></span>Transports Catalog</a> </li>
+ <li><a href="../../userguide/properties.html" title="Properties Catalog"><span class="none"></span>Properties Catalog</a> </li>
+ <li><a href="../../userguide/xpath.html" title="XPath functions and Variables"><span class="none"></span>XPath functions and Variables</a> </li>
+ <li><a href="../../userguide/extending.html" title="Extending Synapse"><span class="none"></span>Extending Synapse</a> </li>
+ <li><a href="../../userguide/template_library.html" title="Synapse Template Libraries"><span class="none"></span>Synapse Template Libraries</a> </li>
+ <li><a href="../../userguide/upgrading.html" title="Upgrading"><span class="none"></span>Upgrading</a> </li>
+ <li><a href="../../userguide/deployment.html" title="Deployment"><span class="none"></span>Deployment</a> </li>
+ <li><a href="../../apidocs/" title="Javadocs"><span class="none"></span>Javadocs</a> </li>
+ <li><a href="../../userguide/faq.html" title="FAQ"><span class="none"></span>FAQ</a> </li>
+ <li class="nav-header">Developer Resources</li>
+ <li><a href="../../dev/developer-guide.html" title="Developer Guide"><span class="none"></span>Developer Guide</a> </li>
+ <li><a href="../../dev/best-practices.html" title="Development Best Practices"><span class="none"></span>Development Best Practices</a> </li>
+ <li><a href="../../dev/release-process.html" title="Release Process"><span class="none"></span>Release Process</a> </li>
+ <li class="nav-header">Project Details</li>
+ <li><a href="../../project-info.html" title="Overview"><span class="none"></span>Overview</a> </li>
+ <li><a href="../../mail-lists.html" title="Mailing Lists"><span class="none"></span>Mailing Lists</a> </li>
+ <li><a href="../../source-repository.html" title="Source Repository"><span class="none"></span>Source Repository</a> </li>
+ <li><a href="../../issue-tracking.html" title="Issue Tracking"><span class="none"></span>Issue Tracking</a> </li>
+ <li><a href="../../dependency-management.html" title="Dependencies"><span class="none"></span>Dependencies</a> </li>
+ <li><a href="../../team-list.html" title="Project Team"><span class="none"></span>Project Team</a> </li>
+ </ul>
+ <hr />
+ <div id="poweredBy">
+ <div class="clear"></div>
+ <div class="clear"></div>
+ <div class="clear"></div>
+ <div class="clear"></div>
+ <a href="http://maven.apache.org/" title="Built by Maven" class="poweredBy"><img class="builtBy" alt="Built by Maven" src="../../images/logos/maven-feather.png" /></a>
+ </div>
+ </div>
+ </div>
+ <div id="bodyColumn" class="span10" >
+
+
+ <div class="section">
+<h2><a name="Sample_360:_Introduction_to_DBLookup_Mediator"></a>Sample 360: Introduction to DBLookup Mediator</h2>
+
+<div class="xmlConf"><definitions xmlns="http://ws.apache.org/ns/synapse">
+
+ <sequence name="myFaultHandler">
+ <makefault response="true">
+ <code xmlns:tns="http://www.w3.org/2003/05/soap-envelope" value="tns:Receiver"/>
+ <reason expression="get-property('ERROR_MESSAGE')"/>
+ </makefault>
+ <send/>
+ <drop/>
+ </sequence>
+
+ <sequence name="main" onError="myFaultHandler">
+ <in>
+ <log level="custom">
+ <property name="text" value="** Looking up from the Database **"/>
+ </log>
+ <dblookup>
+ <connection>
+ <pool>
+ <driver>org.apache.derby.jdbc.ClientDriver</driver>
+ <url>jdbc:derby://localhost:1527/synapsedb;create=false</url>
+ <user>synapse</user>
+ <password>synapse</password>
+ </pool>
+ </connection>
+ <statement>
+ <sql>select * from company where name =?</sql>
+ <parameter xmlns:m0="http://services.samples"
+ expression="//m0:getQuote/m0:request/m0:symbol" type="VARCHAR"/>
+ <result name="company_id" column="id"/>
+ </statement>
+ </dblookup>
+
+ <switch source="get-property('company_id')">
+ <case regex="c1">
+ <log level="custom">
+ <property name="text"
+ expression="fn:concat('Company ID - ',get-property('company_id'))"/>
+ </log>
+ <send>
+ <endpoint>
+ <address uri="http://localhost:9000/services/SimpleStockQuoteService"/>
+ </endpoint>
+ </send>
+ </case>
+ <case regex="c2">
+ <log level="custom">
+ <property name="text"
+ expression="fn:concat('Company ID - ',get-property('company_id'))"/>
+ </log>
+ <send>
+ <endpoint>
+ <address uri="http://localhost:9000/services/SimpleStockQuoteService"/>
+ </endpoint>
+ </send>
+ </case>
+ <case regex="c3">
+ <log level="custom">
+ <property name="text"
+ expression="fn:concat('Company ID - ',get-property('company_id'))"/>
+ </log>
+ <send>
+ <endpoint>
+ <address uri="http://localhost:9000/services/SimpleStockQuoteService"/>
+ </endpoint>
+ </send>
+ </case>
+ <default>
+ <log level="custom">
+ <property name="text" value="** Unrecognized Company ID **"/>
+ </log>
+ <makefault response="true">
+ <code xmlns:tns="http://www.w3.org/2003/05/soap-envelope"
+ value="tns:Receiver"/>
+ <reason value="** Unrecognized Company ID **"/>
+ </makefault>
+ <send/>
+ <drop/>
+ </default>
+ </switch>
+ <drop/>
+ </in>
+
+ <out>
+ <send/>
+ </out>
+
+ </sequence>
+
+</definitions></div>
+
+<div class="section">
+<h3><a name="Objective"></a>Objective</h3>
+
+<p>
+ Demonstrating how to perform database lookups during mediation using the dblookup
+ mediator
+ </p>
+ </div>
+
+<div class="section">
+<h3><a name="Pre-requisites"></a>Pre-requisites</h3>
+
+<p>
+ </p>
+<ul>
+
+<li>
+ Setup a Derby database as described in the <a href="setup/db.html">database setup guide</a>
+ </li>
+
+<li>
+ Deploy the SimpleStockQuoteService in the sample Axis2 server and start Axis2
+ </li>
+
+<li>
+ Start Synapse using the configuration numbered 360 (repository/conf/sample/synapse_sample_360.xml)
+
+<div class="command">
+ Unix/Linux: sh synapse.sh -sample 360<br />
+ Windows: synapse.bat -sample 360
+ </div>
+ </li>
+ </ul>
+
+ </div>
+
+<div class="section">
+<h3><a name="Executing_the_Client"></a>Executing the Client</h3>
+
+<p>
+ This sample demonstrates simple database read operations through Synapse. When a
+ message arrives at dblookup mediator, it opens a connection to the database and
+ executes the given SQL query. The SQL query uses '?' character for attributes that
+ will be filled at runtime. The parameters define how to calculate the value of
+ those attributes at runtime. In this sample a dblookup mediator has been used to
+ extract 'id' of the company from the company database using the symbol which is
+ extracted from the SOAP envelope by evaluating an XPath. Then 'id' bases switching
+ will be done by a switch mediator.
+ </p>
+
+<p>
+ To try this out, first request a stock quote for the symbol 'IBM' as follows.
+ </p>
+
+<div class="command">ant stockquote -Daddurl=http://localhost:9000/services/SimpleStockQuoteService -Dtrpurl=http://localhost:8280/ -Dsymbol=IBM</div>
+
+<p>
+ Synapse console will display the following message.
+ </p>
+
+<div class="consoleOutput">INFO LogMediator text = ** Looking up from the Database **
+ INFO LogMediator text = Company ID – c1</div>
+
+<p>
+ Now request a quote for the symbol 'SUN'.
+ </p>
+
+<div class="command">ant stockquote -Daddurl=http://localhost:9000/services/SimpleStockQuoteService -Dtrpurl=http://localhost:8280/ -Dsymbol=SUN</div>
+
+<p>
+ Synapse will display the following output.
+ </p>
+
+<div class="consoleOutput">INFO LogMediator text = ** Looking up from the Database **
+INFO LogMediator text = Company ID – c2</div>
+
+<p>
+ Finally send a stock quote request for the symbol 'MSFT'.
+ </p>
+
+<div class="command">ant stockquote -Daddurl=http://localhost:9000/services/SimpleStockQuoteService -Dtrpurl=http://localhost:8280/ -Dsymbol=MSFT</div>
+
+<p>
+ In this case Synapse will display the following output.
+ </p>
+
+<div class="consoleOutput">INFO LogMediator text = ** Looking up from the Database **
+INFO LogMediator text = Company ID – c2</div>
+
+<p>
+ If you send any requests with different symbols, dblookup mediator will return
+ an empty result set, since those symbols are not stored in the Derby database.
+ So as a result Synapse will not be able to determine the company ID, which will
+ result in the following log entry (from the default case in the switch mediator).
+ </p>
+
+<div class="consoleOutput">INFO LogMediator text = ** Unrecognized Company ID **</div>
+ </div>
+ </div>
+
+<p><a href="../samples.html">Back to Catalog</a></p>
+
+
+ </div>
+ </div>
+ </div>
+ <hr/>
+ <footer>
+ <div class="container-fluid">
+ <div class="row-fluid">
+ <p>Copyright ©2005–2023
+<a href="http://www.apache.org/">Apache Software Foundation</a>.
+All rights reserved.</p>
+ </div>
+ </div>
+ </footer>
+ </body>
+</html>
Added: synapse/site/3_0_2/userguide/samples/sample361.html
URL: http://svn.apache.org/viewvc/synapse/site/3_0_2/userguide/samples/sample361.html?rev=1909775&view=auto
==============================================================================
--- synapse/site/3_0_2/userguide/samples/sample361.html (added)
+++ synapse/site/3_0_2/userguide/samples/sample361.html Fri May 12 16:09:34 2023
@@ -0,0 +1,218 @@
+<!DOCTYPE html>
+<!--
+ | Generated by Apache Maven Doxia Site Renderer 1.7.4 at 2023-05-04
+ | Rendered using Apache Maven Fluido Skin 1.6
+-->
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+ <head>
+ <meta charset="UTF-8" />
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
+ <meta name="Date-Revision-yyyymmdd" content="20230504" />
+ <meta http-equiv="Content-Language" content="en" />
+ <title>Apache Synapse – Apache Synapse - Sample 361</title>
+ <link rel="stylesheet" href="../../css/apache-maven-fluido-1.6.min.css" />
+ <link rel="stylesheet" href="../../css/site.css" />
+ <link rel="stylesheet" href="../../css/print.css" media="print" />
+ <script type="text/javascript" src="../../js/apache-maven-fluido-1.6.min.js"></script>
+ </head>
+ <body class="topBarDisabled">
+ <div class="container-fluid">
+ <div id="banner">
+ <div class="pull-left"><div id="bannerLeft"><h2>Apache Synapse</h2>
+</div>
+</div>
+ <div class="pull-right"></div>
+ <div class="clear"><hr/></div>
+ </div>
+
+ <div id="breadcrumbs">
+ <ul class="breadcrumb">
+ <li id="publishDate">Last Published: 2023-05-04<span class="divider">|</span>
+</li>
+ <li id="projectVersion">Version: 3.0.2</li>
+ </ul>
+ </div>
+ <div class="row-fluid">
+ <div id="leftColumn" class="span2">
+ <div class="well sidebar-nav">
+<ul class="nav nav-list">
+ <li class="nav-header">Main Menu</li>
+ <li><a href="../../index.html" title="Home"><span class="none"></span>Home</a> </li>
+ <li><a href="../../download.html" title="Download"><span class="none"></span>Download</a> </li>
+ <li><a href="../../history.html" title="History"><span class="none"></span>History</a> </li>
+ <li><a href="http://www.apache.org/licenses/LICENSE-2.0" class="externalLink" title="License"><span class="none"></span>License</a> </li>
+ <li><a href="http://www.apache.org/foundation/thanks.html" class="externalLink" title="Thanks"><span class="none"></span>Thanks</a> </li>
+ <li><a href="http://www.apache.org/foundation/sponsorship.html" class="externalLink" title="Sponsorship"><span class="none"></span>Sponsorship</a> </li>
+ <li><a href="http://www.apache.org/security/" class="externalLink" title="Security"><span class="none"></span>Security</a> </li>
+ <li class="nav-header">Documentation</li>
+ <li><a href="../../userguide/installation.html" title="Installation Guide"><span class="none"></span>Installation Guide</a> </li>
+ <li><a href="../../userguide/quick_start.html" title="Quick Start Guide"><span class="none"></span>Quick Start Guide</a> </li>
+ <li><a href="../../userguide/samples/setup/index.html" title="Samples Setup Guide"><span class="none"></span>Samples Setup Guide</a> </li>
+ <li><a href="../../userguide/samples.html" title="Samples Catalog"><span class="none"></span>Samples Catalog</a> </li>
+ <li><a href="../../userguide/config.html" title="Configuration Language"><span class="none"></span>Configuration Language</a> </li>
+ <li><a href="../../userguide/mediators.html" title="Mediators Catalog"><span class="none"></span>Mediators Catalog</a> </li>
+ <li><a href="../../userguide/transports.html" title="Transports Catalog"><span class="none"></span>Transports Catalog</a> </li>
+ <li><a href="../../userguide/properties.html" title="Properties Catalog"><span class="none"></span>Properties Catalog</a> </li>
+ <li><a href="../../userguide/xpath.html" title="XPath functions and Variables"><span class="none"></span>XPath functions and Variables</a> </li>
+ <li><a href="../../userguide/extending.html" title="Extending Synapse"><span class="none"></span>Extending Synapse</a> </li>
+ <li><a href="../../userguide/template_library.html" title="Synapse Template Libraries"><span class="none"></span>Synapse Template Libraries</a> </li>
+ <li><a href="../../userguide/upgrading.html" title="Upgrading"><span class="none"></span>Upgrading</a> </li>
+ <li><a href="../../userguide/deployment.html" title="Deployment"><span class="none"></span>Deployment</a> </li>
+ <li><a href="../../apidocs/" title="Javadocs"><span class="none"></span>Javadocs</a> </li>
+ <li><a href="../../userguide/faq.html" title="FAQ"><span class="none"></span>FAQ</a> </li>
+ <li class="nav-header">Developer Resources</li>
+ <li><a href="../../dev/developer-guide.html" title="Developer Guide"><span class="none"></span>Developer Guide</a> </li>
+ <li><a href="../../dev/best-practices.html" title="Development Best Practices"><span class="none"></span>Development Best Practices</a> </li>
+ <li><a href="../../dev/release-process.html" title="Release Process"><span class="none"></span>Release Process</a> </li>
+ <li class="nav-header">Project Details</li>
+ <li><a href="../../project-info.html" title="Overview"><span class="none"></span>Overview</a> </li>
+ <li><a href="../../mail-lists.html" title="Mailing Lists"><span class="none"></span>Mailing Lists</a> </li>
+ <li><a href="../../source-repository.html" title="Source Repository"><span class="none"></span>Source Repository</a> </li>
+ <li><a href="../../issue-tracking.html" title="Issue Tracking"><span class="none"></span>Issue Tracking</a> </li>
+ <li><a href="../../dependency-management.html" title="Dependencies"><span class="none"></span>Dependencies</a> </li>
+ <li><a href="../../team-list.html" title="Project Team"><span class="none"></span>Project Team</a> </li>
+ </ul>
+ <hr />
+ <div id="poweredBy">
+ <div class="clear"></div>
+ <div class="clear"></div>
+ <div class="clear"></div>
+ <div class="clear"></div>
+ <a href="http://maven.apache.org/" title="Built by Maven" class="poweredBy"><img class="builtBy" alt="Built by Maven" src="../../images/logos/maven-feather.png" /></a>
+ </div>
+ </div>
+ </div>
+ <div id="bodyColumn" class="span10" >
+
+
+ <div class="section">
+<h2><a name="Sample_361:_Introduction_to_DBReport_Mediator"></a>Sample 361: Introduction to DBReport Mediator</h2>
+
+<div class="xmlConf"><definitions xmlns="http://ws.apache.org/ns/synapse">
+
+ <sequence name="main">
+ <in>
+ <send>
+ <endpoint>
+ <address uri="http://localhost:9000/services/SimpleStockQuoteService"/>
+ </endpoint>
+ </send>
+ </in>
+
+ <out>
+ <log level="custom">
+ <property name="text" value="** Reporting to the Database **"/>
+ </log>
+ <dbreport>
+ <connection>
+ <pool>
+ <driver>org.apache.derby.jdbc.ClientDriver</driver>
+ <url>jdbc:derby://localhost:1527/synapsedb;create=false</url>
+ <user>synapse</user>
+ <password>synapse</password>
+ </pool>
+ </connection>
+ <statement>
+ <sql>update company set price=? where name =?</sql>
+ <parameter xmlns:m0="http://services.samples"
+ expression="//m0:return/m0:last/child::text()" type="DOUBLE"/>
+ <parameter xmlns:m0="http://services.samples"
+ expression="//m0:return/m0:symbol/child::text()" type="VARCHAR"/>
+ </statement>
+ </dbreport>
+ <send/>
+ </out>
+ </sequence>
+
+</definitions></div>
+
+<div class="section">
+<h3><a name="Objective"></a>Objective</h3>
+
+<p>
+ <a href="sample360.html">Sample 360</a> shows how to perform database lookups
+ in Synapse. This sample illustrates how to write to a given database from
+ Synapse using the dbreport mediator.
+ </p>
+ </div>
+
+<div class="section">
+<h3><a name="Pre-requisites"></a>Pre-requisites</h3>
+
+<p>
+ </p>
+<ul>
+
+<li>
+ Setup a Derby database as described in the <a href="setup/db.html">database setup guide</a>
+ </li>
+
+<li>
+ Deploy the SimpleStockQuoteService in the sample Axis2 server and start Axis2
+ </li>
+
+<li>
+ Start Synapse using the configuration numbered 361 (repository/conf/sample/synapse_sample_361.xml)
+
+<div class="command">
+ Unix/Linux: sh synapse.sh -sample 361<br />
+ Windows: synapse.bat -sample 361
+ </div>
+ </li>
+ </ul>
+
+ </div>
+
+<div class="section">
+<h3><a name="Executing_the_Client"></a>Executing the Client</h3>
+
+<p>
+ This sample demonstrates how to perform simple database write operations in
+ Synapse. The dbreport mediator writes (i.e. inserts one row) to a table using the
+ details available in messages. It works the same way as the dblookup mediator.
+ In this sample, dbreport mediator is used for updating the stock price of the
+ company using the last quote value which is calculated by evaluating an XPath
+ against the response message. After running this sample, user can check the
+ company table using the Derby client tool. It will show the value inserted by the
+ dbreport mediator.
+ </p>
+
+<p>
+ To try this out run the sample client as follows.
+ </p>
+
+<div class="command">ant stockquote -Daddurl=http://localhost:9000/services/SimpleStockQuoteService -Dtrpurl=http://localhost:8280/ -Dsymbol=IBM</div>
+
+<p>
+ Now execute the following SQL query against the Derby database using the Derby
+ client tool.
+ </p>
+
+<div class="command">select price from company where name='IBM';</div>
+
+<p>
+ This operation will return the stock quote value returned earlier by Axis2. You
+ can compare the output of the sample Axis2 client with the output of the Derby
+ client tool for confirmation.
+ </p>
+ </div>
+ </div>
+
+<p><a href="../samples.html">Back to Catalog</a></p>
+
+
+ </div>
+ </div>
+ </div>
+ <hr/>
+ <footer>
+ <div class="container-fluid">
+ <div class="row-fluid">
+ <p>Copyright ©2005–2023
+<a href="http://www.apache.org/">Apache Software Foundation</a>.
+All rights reserved.</p>
+ </div>
+ </div>
+ </footer>
+ </body>
+</html>
Added: synapse/site/3_0_2/userguide/samples/sample362.html
URL: http://svn.apache.org/viewvc/synapse/site/3_0_2/userguide/samples/sample362.html?rev=1909775&view=auto
==============================================================================
--- synapse/site/3_0_2/userguide/samples/sample362.html (added)
+++ synapse/site/3_0_2/userguide/samples/sample362.html Fri May 12 16:09:34 2023
@@ -0,0 +1,238 @@
+<!DOCTYPE html>
+<!--
+ | Generated by Apache Maven Doxia Site Renderer 1.7.4 at 2023-05-04
+ | Rendered using Apache Maven Fluido Skin 1.6
+-->
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+ <head>
+ <meta charset="UTF-8" />
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
+ <meta name="Date-Revision-yyyymmdd" content="20230504" />
+ <meta http-equiv="Content-Language" content="en" />
+ <title>Apache Synapse – Apache Synapse - Sample 362</title>
+ <link rel="stylesheet" href="../../css/apache-maven-fluido-1.6.min.css" />
+ <link rel="stylesheet" href="../../css/site.css" />
+ <link rel="stylesheet" href="../../css/print.css" media="print" />
+ <script type="text/javascript" src="../../js/apache-maven-fluido-1.6.min.js"></script>
+ </head>
+ <body class="topBarDisabled">
+ <div class="container-fluid">
+ <div id="banner">
+ <div class="pull-left"><div id="bannerLeft"><h2>Apache Synapse</h2>
+</div>
+</div>
+ <div class="pull-right"></div>
+ <div class="clear"><hr/></div>
+ </div>
+
+ <div id="breadcrumbs">
+ <ul class="breadcrumb">
+ <li id="publishDate">Last Published: 2023-05-04<span class="divider">|</span>
+</li>
+ <li id="projectVersion">Version: 3.0.2</li>
+ </ul>
+ </div>
+ <div class="row-fluid">
+ <div id="leftColumn" class="span2">
+ <div class="well sidebar-nav">
+<ul class="nav nav-list">
+ <li class="nav-header">Main Menu</li>
+ <li><a href="../../index.html" title="Home"><span class="none"></span>Home</a> </li>
+ <li><a href="../../download.html" title="Download"><span class="none"></span>Download</a> </li>
+ <li><a href="../../history.html" title="History"><span class="none"></span>History</a> </li>
+ <li><a href="http://www.apache.org/licenses/LICENSE-2.0" class="externalLink" title="License"><span class="none"></span>License</a> </li>
+ <li><a href="http://www.apache.org/foundation/thanks.html" class="externalLink" title="Thanks"><span class="none"></span>Thanks</a> </li>
+ <li><a href="http://www.apache.org/foundation/sponsorship.html" class="externalLink" title="Sponsorship"><span class="none"></span>Sponsorship</a> </li>
+ <li><a href="http://www.apache.org/security/" class="externalLink" title="Security"><span class="none"></span>Security</a> </li>
+ <li class="nav-header">Documentation</li>
+ <li><a href="../../userguide/installation.html" title="Installation Guide"><span class="none"></span>Installation Guide</a> </li>
+ <li><a href="../../userguide/quick_start.html" title="Quick Start Guide"><span class="none"></span>Quick Start Guide</a> </li>
+ <li><a href="../../userguide/samples/setup/index.html" title="Samples Setup Guide"><span class="none"></span>Samples Setup Guide</a> </li>
+ <li><a href="../../userguide/samples.html" title="Samples Catalog"><span class="none"></span>Samples Catalog</a> </li>
+ <li><a href="../../userguide/config.html" title="Configuration Language"><span class="none"></span>Configuration Language</a> </li>
+ <li><a href="../../userguide/mediators.html" title="Mediators Catalog"><span class="none"></span>Mediators Catalog</a> </li>
+ <li><a href="../../userguide/transports.html" title="Transports Catalog"><span class="none"></span>Transports Catalog</a> </li>
+ <li><a href="../../userguide/properties.html" title="Properties Catalog"><span class="none"></span>Properties Catalog</a> </li>
+ <li><a href="../../userguide/xpath.html" title="XPath functions and Variables"><span class="none"></span>XPath functions and Variables</a> </li>
+ <li><a href="../../userguide/extending.html" title="Extending Synapse"><span class="none"></span>Extending Synapse</a> </li>
+ <li><a href="../../userguide/template_library.html" title="Synapse Template Libraries"><span class="none"></span>Synapse Template Libraries</a> </li>
+ <li><a href="../../userguide/upgrading.html" title="Upgrading"><span class="none"></span>Upgrading</a> </li>
+ <li><a href="../../userguide/deployment.html" title="Deployment"><span class="none"></span>Deployment</a> </li>
+ <li><a href="../../apidocs/" title="Javadocs"><span class="none"></span>Javadocs</a> </li>
+ <li><a href="../../userguide/faq.html" title="FAQ"><span class="none"></span>FAQ</a> </li>
+ <li class="nav-header">Developer Resources</li>
+ <li><a href="../../dev/developer-guide.html" title="Developer Guide"><span class="none"></span>Developer Guide</a> </li>
+ <li><a href="../../dev/best-practices.html" title="Development Best Practices"><span class="none"></span>Development Best Practices</a> </li>
+ <li><a href="../../dev/release-process.html" title="Release Process"><span class="none"></span>Release Process</a> </li>
+ <li class="nav-header">Project Details</li>
+ <li><a href="../../project-info.html" title="Overview"><span class="none"></span>Overview</a> </li>
+ <li><a href="../../mail-lists.html" title="Mailing Lists"><span class="none"></span>Mailing Lists</a> </li>
+ <li><a href="../../source-repository.html" title="Source Repository"><span class="none"></span>Source Repository</a> </li>
+ <li><a href="../../issue-tracking.html" title="Issue Tracking"><span class="none"></span>Issue Tracking</a> </li>
+ <li><a href="../../dependency-management.html" title="Dependencies"><span class="none"></span>Dependencies</a> </li>
+ <li><a href="../../team-list.html" title="Project Team"><span class="none"></span>Project Team</a> </li>
+ </ul>
+ <hr />
+ <div id="poweredBy">
+ <div class="clear"></div>
+ <div class="clear"></div>
+ <div class="clear"></div>
+ <div class="clear"></div>
+ <a href="http://maven.apache.org/" title="Built by Maven" class="poweredBy"><img class="builtBy" alt="Built by Maven" src="../../images/logos/maven-feather.png" /></a>
+ </div>
+ </div>
+ </div>
+ <div id="bodyColumn" class="span10" >
+
+
+ <div class="section">
+<h2><a name="Sample_362:_Perform_Database_Lookups_and_Updates_in_the_Same_Mediation_Sequence"></a>Sample 362: Perform Database Lookups and Updates in the Same Mediation Sequence</h2>
+
+<div class="xmlConf"><definitions xmlns="http://ws.apache.org/ns/synapse">
+
+ <sequence name="main">
+ <in>
+ <send>
+ <endpoint>
+ <address uri="http://localhost:9000/services/SimpleStockQuoteService"/>
+ </endpoint>
+ </send>
+ </in>
+
+ <out>
+ <log level="custom">
+ <property name="text" value="** Reporting to the Database **"/>
+ </log>
+
+ <dbreport>
+ <connection>
+ <pool>
+ <driver>org.apache.derby.jdbc.ClientDriver</driver>
+ <url>jdbc:derby://localhost:1527/synapsedb;create=false</url>
+ <user>synapse</user>
+ <password>synapse</password>
+ </pool>
+ </connection>
+ <statement>
+ <sql>update company set price=? where name =?</sql>
+ <parameter xmlns:m0="http://services.samples"
+ expression="//m0:return/m0:last/child::text()" type="DOUBLE"/>
+ <parameter xmlns:m0="http://services.samples"
+ expression="//m0:return/m0:symbol/child::text()" type="VARCHAR"/>
+ </statement>
+ </dbreport>
+ <log level="custom">
+ <property name="text" value="** Looking up from the Database **"/>
+ </log>
+ <dblookup>
+ <connection>
+ <pool>
+ <driver>org.apache.derby.jdbc.ClientDriver</driver>
+ <url>jdbc:derby://localhost:1527/synapsedb;create=false</url>
+ <user>synapse</user>
+ <password>synapse</password>
+ </pool>
+ </connection>
+ <statement>
+ <sql>select * from company where name =?</sql>
+ <parameter xmlns:m0="http://services.samples"
+ expression="//m0:return/m0:symbol/child::text()" type="VARCHAR"/>
+ <result name="stock_price" column="price"/>
+ </statement>
+ </dblookup>
+ <log level="custom">
+ <property name="text"
+ expression="fn:concat('Stock price - ',get-property('stock_price'))"/>
+ </log>
+ <send/>
+ </out>
+ </sequence>
+
+</definitions></div>
+
+<div class="section">
+<h3><a name="Objective"></a>Objective</h3>
+
+<p>
+ <a href="sample360.html">Sample 360</a> and <a href="sample361.html">sample 361</a>
+ shows how to use the dblookup mediator and dbreport mediator separately. This sample
+ combines them in a single mediation sequence to perform both database lookup and
+ update operations.
+ </p>
+ </div>
+
+<div class="section">
+<h3><a name="Pre-requisites"></a>Pre-requisites</h3>
+
+<p>
+ </p>
+<ul>
+
+<li>
+ Setup a Derby database as described in the <a href="setup/db.html">database setup guide</a>
+ </li>
+
+<li>
+ Deploy the SimpleStockQuoteService in the sample Axis2 server and start Axis2
+ </li>
+
+<li>
+ Start Synapse using the configuration numbered 362 (repository/conf/sample/synapse_sample_362.xml)
+
+<div class="command">
+ Unix/Linux: sh synapse.sh -sample 362<br />
+ Windows: synapse.bat -sample 362
+ </div>
+ </li>
+ </ul>
+
+ </div>
+
+<div class="section">
+<h3><a name="Executing_the_Client"></a>Executing the Client</h3>
+
+<p>
+ In this sample, the dbreport mediator works the same way as in
+ <a href="sample361.html">sample 361</a>. It updates the price for the given company
+ using the response messages content. Then the dblookup mediator reads the last
+ updated value from the company database and logs it to the console.
+ </p>
+
+<p>
+ Run the sample client as follows.
+ </p>
+
+<div class="command">ant stockquote -Daddurl=http://localhost:9000/services/SimpleStockQuoteService -Dtrpurl=http://localhost:8280/ -Dsymbol=IBM</div>
+
+<p>
+ Synapse will update the database using the stock quote value available in the
+ response sent by Axis2. Then the same value will be retrieved from the database
+ and logged as follows.
+ </p>
+
+<div class="consoleOutput">INFO LogMediator text = ** Reporting to the Database **
+...
+INFO LogMediator text = ** Looking up from the Database **
+...
+INFO LogMediator text = Stock price - 153.47886496064808</div>
+ </div>
+ </div>
+
+<p><a href="../samples.html">Back to Catalog</a></p>
+
+
+ </div>
+ </div>
+ </div>
+ <hr/>
+ <footer>
+ <div class="container-fluid">
+ <div class="row-fluid">
+ <p>Copyright ©2005–2023
+<a href="http://www.apache.org/">Apache Software Foundation</a>.
+All rights reserved.</p>
+ </div>
+ </div>
+ </footer>
+ </body>
+</html>