Added: synapse/site/3_0_1/userguide/samples/sample451.html URL: http://svn.apache.org/viewvc/synapse/site/3_0_1/userguide/samples/sample451.html?rev=1817077&view=auto ============================================================================== --- synapse/site/3_0_1/userguide/samples/sample451.html (added) +++ synapse/site/3_0_1/userguide/samples/sample451.html Mon Dec 4 09:53:57 2017 @@ -0,0 +1,195 @@ +<!DOCTYPE html> +<!-- + | Generated by Apache Maven Doxia Site Renderer 1.7.4 at 2017-12-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="20171204" /> + <meta http-equiv="Content-Language" content="en" /> + <title>Apache Synapse – Apache Synapse - Sample 451</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: 2017-12-04<span class="divider">|</span> +</li> + <li id="projectVersion">Version: 3.0.1</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_451:_Conditional_URL_Rewriting"></a>Sample 451: Conditional URL Rewriting</h2> + +<div class="xmlConf"><definitions xmlns="http://ws.apache.org/ns/synapse"> + + <sequence name="main"> + <in> + <rewrite> + <rule> + <condition> + <and> + <equal type="url" source="host" value="localhost"/> + <not> + <equal type="url" source="protocol" value="https"/> + </not> + </and> + </condition> + <action fragment="protocol" value="https"/> + <action fragment="port" value="9002"/> + </rule> + </rewrite> + <send/> + </in> + <out> + <send/> + </out> + </sequence> + +</definitions></div> + +<div class="section"> +<h3><a name="Objective"></a>Objective</h3> + +<p> + Demonstrate the ability of the URL rewrite mediator to evaluate conditions on + messages and perform rewrites based on the results + </p> + </div> + +<div class="section"> +<h3><a name="Pre-requisites"></a>Pre-requisites</h3> + +<p> + </p> +<ul> + +<li> + Deploy the SimpleStockQuoteService in the sample Axis2 server and start Axis2 + </li> + +<li> + Start Synapse using the configuration numbered 451 (repository/conf/sample/synapse_sample_451.xml) + +<div class="command"> + Unix/Linux: sh synapse.sh -sample 451<br /> + Windows: synapse.bat -sample 451 + </div> + </li> + </ul> + + </div> + +<div class="section"> +<h3><a name="Executing_the_Client"></a>Executing the Client</h3> + +<p> + Invoke the Axis2 client and send some requests to Synapse with different address + URL values. If the address URL value contains 'localhost' as the hostname and 'https' + as the protocol prefix, Synapse will route the message as it is. But if the + hostname is 'localhost' and the protocol is not https, Synapse will rewrite the + URL by setting 'https' as the protocol. The port number will also be set to the + HTTPS port of the Axis2 server. + </p> + +<p> + If you invoke the client as follows, Synapse will rewrite the 'To' header and + forward the message to Axis2 over HTTPS. + </p> + +<div class="command">ant stockquote -Daddurl=http://localhost:9000/services/SimpleStockQuoteService -Dtrpurl=http://localhost:8280/</div> + +<p> + The condition evaluation feature is provided by the Synapse evaluator framework. + Currently one can evaluate expressions on URL values, query parameters, transport + headers, properties and SOAP envelope content using this framework. Hence URL + rewriting can be done based on any of these aspects. + </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–2017 +<a href="http://www.apache.org/">Apache Software Foundation</a>. +All rights reserved.</p> + </div> + </div> + </footer> + </body> +</html>
Added: synapse/site/3_0_1/userguide/samples/sample452.html URL: http://svn.apache.org/viewvc/synapse/site/3_0_1/userguide/samples/sample452.html?rev=1817077&view=auto ============================================================================== --- synapse/site/3_0_1/userguide/samples/sample452.html (added) +++ synapse/site/3_0_1/userguide/samples/sample452.html Mon Dec 4 09:53:57 2017 @@ -0,0 +1,202 @@ +<!DOCTYPE html> +<!-- + | Generated by Apache Maven Doxia Site Renderer 1.7.4 at 2017-12-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="20171204" /> + <meta http-equiv="Content-Language" content="en" /> + <title>Apache Synapse – Apache Synapse - Sample 452</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: 2017-12-04<span class="divider">|</span> +</li> + <li id="projectVersion">Version: 3.0.1</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_452:_Conditional_URL_Rewriting_with_Multiple_Rules"></a>Sample 452: Conditional URL Rewriting with Multiple Rules</h2> + +<div class="xmlConf"><definitions xmlns="http://ws.apache.org/ns/synapse"> + + <sequence name="main"> + <in> + <property name="http.port" value="9000"/> + <property name="https.port" value="9002"/> + <rewrite> + <rule> + <action fragment="host" value="localhost"/> + <action fragment="path" type="prepend" value="/services"/> + </rule> + <rule> + <condition> + <equal type="url" source="protocol" value="http"/> + </condition> + <action fragment="port" xpath="get-property('http.port')"/> + </rule> + <rule> + <condition> + <equal type="url" source="protocol" value="https"/> + </condition> + <action fragment="port" xpath="get-property('https.port')"/> + </rule> + </rewrite> + <log level="full"/> + <send/> + </in> + <out> + <send/> + </out> + </sequence> + +</definitions></div> + +<div class="section"> +<h3><a name="Objective"></a>Objective</h3> + +<p> + Demonstrate the ability of the URL rewrite mediator to perform rewrites based + on multiple rules + </p> + </div> + +<div class="section"> +<h3><a name="Pre-requisites"></a>Pre-requisites</h3> + +<p> + </p> +<ul> + +<li> + Deploy the SimpleStockQuoteService in the sample Axis2 server and start Axis2 + </li> + +<li> + Start Synapse using the configuration numbered 452 (repository/conf/sample/synapse_sample_452.xml) + +<div class="command"> + Unix/Linux: sh synapse.sh -sample 452<br /> + Windows: synapse.bat -sample 452 + </div> + </li> + </ul> + + </div> + +<div class="section"> +<h3><a name="Executing_the_Client"></a>Executing the Client</h3> + +<p> + One may specify multiple rewrite rules for a URL rewrite mediator instance. In + that case Synapse will execute all the rules on each message, in the order they + appear. This particular sample lists 3 rewrite rules. To try it out, invoke the + client as follows. + </p> + +<div class="command">ant stockquote -Dtrpurl=http://localhost:8280 -Daddurl=http://test.com/SimpleStockQuoteService</div> + +<p> + The provided address URL does not contain a port number and the context. The URL + rewrite mediator will replace the hostname (test.com) with 'localhost' and add the + context '/services' to the path. Then it will add the appropriate port number to + the URL by looking at the protocol prefix. Ultimately the service request will be + routed the sample Axis2 server and the client will receive a valid response. + </p> + +<p> + Another important aspect shown by this sample is the ability of the URL rewirte + mediator to obtain the necessary values by executing XPath expressions. The port + numbers are calculated by executing an XPath on the messages. + </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–2017 +<a href="http://www.apache.org/">Apache Software Foundation</a>. +All rights reserved.</p> + </div> + </div> + </footer> + </body> +</html> Added: synapse/site/3_0_1/userguide/samples/sample460.html URL: http://svn.apache.org/viewvc/synapse/site/3_0_1/userguide/samples/sample460.html?rev=1817077&view=auto ============================================================================== --- synapse/site/3_0_1/userguide/samples/sample460.html (added) +++ synapse/site/3_0_1/userguide/samples/sample460.html Mon Dec 4 09:53:57 2017 @@ -0,0 +1,203 @@ +<!DOCTYPE html> +<!-- + | Generated by Apache Maven Doxia Site Renderer 1.7.4 at 2017-12-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="20171204" /> + <meta http-equiv="Content-Language" content="en" /> + <title>Apache Synapse – Apache Synapse - Sample 460</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: 2017-12-04<span class="divider">|</span> +</li> + <li id="projectVersion">Version: 3.0.1</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_460:_Introduction_to_the_Spring_Mediator"></a>Sample 460: Introduction to the Spring Mediator</h2> + +<div class="xmlConf"><definitions xmlns="http://ws.apache.org/ns/synapse"> + + <registry provider="org.apache.synapse.registry.url.SimpleURLRegistry"> + <parameter name="root">file:repository/conf/sample/resources/</parameter> + <parameter name="cachableDuration">15000</parameter> + </registry> + + <sequence name="main"> + <!--Setting the Spring Mediator and its Spring Beans xml file location --> + <!--Note that springtest is the bean id used in springCustomLogger.xml --> + <spring bean="springtest" key="spring/springCustomLogger.xml"/> + <send/> + </sequence> + +</definitions></div> + +<p> + This sample configuration loads an external SpringBean from a file named + springCustomLogger.xml. Contents of this file are as follows. + </p> + +<div class="xmlConf"><?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" + "http://www.springframework.org/dtd/spring-beans.dtd"> + +<beans> + + <bean id="springtest" class="samples.mediators.extentions.SpringCustomLogger" singleton="false"> + <property name="userName"><value>"Synapse User"</value></property> + <property name="email"><value>"u...@synapse.org"</value></property> + </bean> + +</beans></div> + + +<div class="section"> +<h3><a name="Objective"></a>Objective</h3> + +<p> + Demonstrate how to initialize and use a SpringBean as a mediator + </p> + </div> + +<div class="section"> +<h3><a name="Pre-requisites"></a>Pre-requisites</h3> + +<p> + </p> +<ul> + +<li> + Deploy the SimpleStockQuoteService in the sample Axis2 server and start Axis2 + </li> + +<li> + Start Synapse using the configuration numbered 460 (repository/conf/sample/synapse_sample_460.xml) + +<div class="command"> + Unix/Linux: sh synapse.sh -sample 460<br /> + Windows: synapse.bat -sample 460 + </div> + </li> + </ul> + + </div> + +<div class="section"> +<h3><a name="Executing_the_Client"></a>Executing the Client</h3> + +<p> + In this sample, the Spring Bean named 'SpringCustomLogger' gets loaded from the + springCustomLogger.xml file and then it is used to log the message ID of each + message being mediated. To see it in action, invoke the sample client as follows. + </p> + +<div class="command">ant stockquote -Daddurl=http://localhost:9000/services/SimpleStockQuoteService -Dtrpurl=http://localhost:8280/</div> + +<p> + If you have enabled logging for the samples.mediators package in the log4j.properties + file, you will see an output similar to the following, on the console. + </p> + +<div class="consoleOutput">2010-09-26 20:46:57,946 [-] [HttpServerWorker-1] INFO SpringCustomLogger Starting Spring Meditor +2010-09-26 20:46:57,946 [-] [HttpServerWorker-1] INFO SpringCustomLogger Bean in Initialized with User:["Synapse User"] +2010-09-26 20:46:57,946 [-] [HttpServerWorker-1] INFO SpringCustomLogger E-MAIL:["u...@synapse.org"] +2010-09-26 20:46:57,946 [-] [HttpServerWorker-1] INFO SpringCustomLogger Massage Id: urn:uuid:383FA8B27D7CC549D91285514217720 +2010-09-26 20:46:57,946 [-] [HttpServerWorker-1] INFO SpringCustomLogger Logged....</div> + +<p> + Similarly you can import any SpringBean into the Synapse runtime using the + spring mediator, and use Spring to execute mediation rules. + </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–2017 +<a href="http://www.apache.org/">Apache Software Foundation</a>. +All rights reserved.</p> + </div> + </div> + </footer> + </body> +</html> Added: synapse/site/3_0_1/userguide/samples/sample470.html URL: http://svn.apache.org/viewvc/synapse/site/3_0_1/userguide/samples/sample470.html?rev=1817077&view=auto ============================================================================== --- synapse/site/3_0_1/userguide/samples/sample470.html (added) +++ synapse/site/3_0_1/userguide/samples/sample470.html Mon Dec 4 09:53:57 2017 @@ -0,0 +1,302 @@ +<!DOCTYPE html> +<!-- + | Generated by Apache Maven Doxia Site Renderer 1.7.4 at 2017-12-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="20171204" /> + <meta http-equiv="Content-Language" content="en" /> + <title>Apache Synapse – Apache Synapse - Sample 470</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: 2017-12-04<span class="divider">|</span> +</li> + <li id="projectVersion">Version: 3.0.1</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_470:_Introduction_to_the_EJB_Mediator_I_-_Invoking_Stateless_Session_Beans"></a>Sample 470: Introduction to the EJB Mediator I - Invoking Stateless Session Beans</h2> + +<div class="xmlConf"><definitions xmlns="http://ws.apache.org/ns/synapse"> + <proxy name="StoreLocatorProxy" transports="https http" startOnLoad="true" trace="disable"> + <target> + <!-- First call StoreLocator#getClosestStore(), then call StoreRegistry#getStoreById() with the result. --> + <inSequence> + <bean action="CREATE" class="samples.bean.Location" var="loc"/> + <bean action="SET_PROPERTY" var="loc" property="latitude" value="{//m:latitude}" xmlns:m="http://services.samples"/> + <bean action="SET_PROPERTY" var="loc" property="longitude" value="{//m:longitude}" xmlns:m="http://services.samples"/> + <ejb class="samples.ejb.StoreLocator" beanstalk="demo" method="getClosestStore" target="store_id" jndiName="StoreLocatorBean/remote"> + <args> + <arg value="{get-property('loc')}"/> + </args> + </ejb> + <ejb class="samples.ejb.StoreRegistry" beanstalk="demo" method="getStoreById" target="store" jndiName="StoreRegistryBean/remote"> + <args> + <arg value="{get-property('store_id')}"/> + </args> + </ejb> + <!-- Prepare the response. --> + <enrich> + <source type="inline" clone="true"> + <getClosestStoreResponse xmlns=""> + <store> + <name>?</name> + <address>?</address> + <phone>?</phone> + </store> + </getClosestStoreResponse> + </source> + <target type="body"/> + </enrich> + <bean action="GET_PROPERTY" var="store" property="name" target="{//store/name/text()}"/> + <bean action="GET_PROPERTY" var="store" property="address" target="{//store/address/text()}"/> + <bean action="GET_PROPERTY" var="store" property="phoneNo" target="{//store/phone/text()}"/> + <!-- Send the response back to the client of the ESB. --> + <respond/> + </inSequence> + </target> + </proxy> +</definitions></div> + +<div class="section"> +<h3><a name="Objective"></a>Objective</h3> + +<p> + Demonstrate the usage of the EJB mediator for invoking EJB Stateless + Session Beans hosted on a remote EJB Container. + </p> + </div> + +<div class="section"> +<h3><a name="Pre-requisites"></a>Pre-requisites</h3> + +<p> + </p> +<ul> + +<li> + Build the backend EJB jar to be hosted on the EJB Container by changing + the directory to SYNAPSE_HOME/samples/axis2Server/src/EJBSampleBeans + and invoking: +<div class="command">mvn clean install</div> + </li> + +<li> + Deploy the built EJB jar + (SYNAPSE_HOME/samples/axis2Server/src/EJBSampleBeans/target/synapse-samples-ejb-1.0.0.jar) + in an EJB Container such as JBoss or GlassFish. + </li> + +<li> + Add minimal client JARs of your EJB Container to SYNAPSE_HOME/lib. + E.g. If you are using JBoss 7, it is sufficient to add the + <i>jboss-client.jar</i> file. + </li> + +<li> + Add the <i>synapse-samples-ejb-1.0.0.jar</i> to SYNAPSE_HOME/lib. (Note: adding + only the remote interfaces of the EJBs will suffice. Here we are using + the complete jar file for simplicity.) + </li> + +<li> + Configure a beanstalk named <i>demo</i> in + SYNAPSE_HOME/repository/conf/synapse.properties. You will need to + specify the JNDI properties of your EJB Container in this configuration. + Some example configurations are shown below. <br /> + For JBoss 7: + +<div class="consoleOutput">synapse.beanstalks=demo,foo +# JNDI properties +synapse.beanstalks.demo.java.naming.factory.url.pkgs=org.jboss.ejb.client.naming +# Cache settings +synapse.beanstalks.demo.cache.warn.limit.stateless=256 +synapse.beanstalks.demo.cache.warn.limit.stateful=256 +synapse.beanstalks.demo.cache.timeout.stateless=30 +synapse.beanstalks.demo.cache.timeout.stateful=30 +</div> + <br /> + For JBoss 6: + +<div class="consoleOutput">synapse.beanstalks=demo,foo +# JNDI properties +synapse.beanstalks.demo.java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory +synapse.beanstalks.demo.java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces +synapse.beanstalks.demo.java.naming.provider.url=localhost:1099 +# Cache settings +synapse.beanstalks.demo.cache.warn.limit.stateless=256 +synapse.beanstalks.demo.cache.warn.limit.stateful=256 +synapse.beanstalks.demo.cache.timeout.stateless=30 +synapse.beanstalks.demo.cache.timeout.stateful=30 +</div> + </li> + +<li> + If the JNDI names assigned to the EJBs by your EJB Container differ from + the JNDI names specified in the sample 470 configuration file + (repository/conf/sample/synapse_sample_470.xml), edit the <i>jndiName</i> + attribute of all < ejb /> mediator invocations in the + <i>synapse_sample_470.xml</i> accordingly. + </li> + +<li> + Start Synapse using the configuration numbered 470 + (repository/conf/sample/synapse_sample_470.xml): + +<div class="command"> + Unix/Linux: sh synapse.sh -sample 470<br /> + Windows: synapse.bat -sample 470 + </div> + </li> + </ul> + + </div> + +<div class="section"> +<h3><a name="Executing_the_Client"></a>Executing the Client</h3> + +<p> + Send the following request to http://localhost:8280/services/StoreLocatorProxy + using a tool such at <a class="externalLink" href="http://ws.apache.org/tcpmon/">TCPMon</a> or curl. + </p> + +<div class="xmlConf"><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"> + <soapenv:Body> + <getClosestStore xmlns="http://services.samples"> + <latitude>78</latitude> + <longitude>8</longitude> + </getClosestStore> + </soapenv:Body> +</soapenv:Envelope> +</div> + +<p> + When the <i>StoreLocatorProxy</i> receives the request, it first creates an instance of + <i>samples.bean.Location</i> using the Bean mediator. + Then, it sets the properties of the newly created bean with the values + extracted from the incoming SOAP message, again using the Bean mediator. + </p> + +<p> + The subsequent EJB mediator invokes the <i>getClosestStore()</i> method on the remote stateless + session bean, <i>StoreLocator</i>, with the previously populated + Location object as an argument and stores the result in the <i>store_id</i> message context + property. Another EJB mediator that follows calls the <i>getStoreById()</i> method + on a second stateless session bean,<i>StoreRegistry</i>, to obtain store details encapsulated in + a JavaBean (an instance of samples.bean.Store) and stores this resulting bean in a message context + property named <i>store</i>. The <i>demo</i> beanstalk provides all necessary configurations + needed for the two remote EJB invocations. + </p> + +<p> + Finally, Enrich and Bean mediators are used to build the response message extracting properties from + the JavaBean stored in the <i>store</i> message context property. + </p> + +<p>A sample response is shown below.</p> + + +<div class="xmlConf"><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"> + <soapenv:Body> + <getClosestStoreResponse> + <store> + <name>Kadawatha</name> + <address>253, Kandy Road, Kadawatha</address> + <phone>0112990789</phone> + </store> + </getClosestStoreResponse> + </soapenv:Body> +</soapenv:Envelope> +</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–2017 +<a href="http://www.apache.org/">Apache Software Foundation</a>. +All rights reserved.</p> + </div> + </div> + </footer> + </body> +</html> Added: synapse/site/3_0_1/userguide/samples/sample471.html URL: http://svn.apache.org/viewvc/synapse/site/3_0_1/userguide/samples/sample471.html?rev=1817077&view=auto ============================================================================== --- synapse/site/3_0_1/userguide/samples/sample471.html (added) +++ synapse/site/3_0_1/userguide/samples/sample471.html Mon Dec 4 09:53:57 2017 @@ -0,0 +1,275 @@ +<!DOCTYPE html> +<!-- + | Generated by Apache Maven Doxia Site Renderer 1.7.4 at 2017-12-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="20171204" /> + <meta http-equiv="Content-Language" content="en" /> + <title>Apache Synapse – Apache Synapse - Sample 471</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: 2017-12-04<span class="divider">|</span> +</li> + <li id="projectVersion">Version: 3.0.1</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_471:_Introduction_to_the_EJB_Mediator_II_-_Invoking_Stateful_Session_Beans"></a>Sample 471: Introduction to the EJB Mediator II - Invoking Stateful Session Beans</h2> + +<div class="xmlConf"><definitions> + <proxy name="BuyAllProxy" transports="https http" startOnLoad="true" trace="disable"> + <target> + <!-- Iterate over all items in the request and call addItem() on the ShoppingCart EJB for each item. --> + <inSequence> + <property name="SESSION_ID" expression="get-property('MessageID')"/> + <iterate xmlns:m0="http://services.samples" preservePayload="false" + expression="//m0:buyItems/m0:items/m0:item"> + <target> + <sequence> + <ejb class="samples.ejb.ShoppingCart" beanstalk="demo" method="addItem" sessionId="{get-property('SESSION_ID')}" jndiName="ShoppingCartBean/remote"> + <args> + <arg value="{//m:item//m:id}" xmlns:m="http://services.samples"/> + <arg value="{//m:item//m:quantity}" xmlns:m="http://services.samples"/> + </args> + </ejb> + <sequence key="collector"/> + </sequence> + </target> + </iterate> + </inSequence> + </target> + </proxy> + + <!-- Prepare the response once all addItem() calls are finished. --> + <sequence name="collector"> + <aggregate> + <onComplete> + <ejb class="samples.ejb.ShoppingCart" beanstalk="demo" method="getItemCount" sessionId="{get-property('SESSION_ID')}" target="ITEM_COUNT"/> + <ejb class="samples.ejb.ShoppingCart" beanstalk="demo" method="getTotal" sessionId="{get-property('SESSION_ID')}" target="TOTAL" remove="true"/> + <payloadFactory> + <format> + <buyAllResponse xmlns=""> + <itemCount>$1</itemCount> + <total>$2</total> + </buyAllResponse> + </format> + <args> + <arg expression="get-property('ITEM_COUNT')"/> + <arg expression="get-property('TOTAL')"/> + </args> + </payloadFactory> + <respond/> + </onComplete> + </aggregate> + </sequence> + +</definitions></div> + +<div class="section"> +<h3><a name="Objective"></a>Objective</h3> + +<p> + Demonstrate the usage of the EJB mediator for invoking EJB Stateful + Session Beans hosted on a remote EJB Container. + </p> + </div> + +<div class="section"> +<h3><a name="Pre-requisites"></a>Pre-requisites</h3> + +<p> + </p> +<ul> + +<li> + Follow steps 1 to 5 in <a href="sample470.html">Sample 470</a> to host the EJBs + in an EJB Container of your choice and to configure the <i>demo</i> beanstalk. + </li> + +<li> + If the JNDI names assigned to the EJBs by your EJB Container differ from + the JNDI names specified in the sample 471 configuration file + (repository/conf/sample/synapse_sample_471.xml), edit the <i>jndiName</i> + attribute of all < ejb /> mediator invocations in the + <i>synapse_sample_471.xml</i> accordingly. + </li> + +<li> + Start Synapse using the configuration numbered 471 + (repository/conf/sample/synapse_sample_471.xml): + +<div class="command"> + Unix/Linux: sh synapse.sh -sample 471<br /> + Windows: synapse.bat -sample 471 + </div> + </li> + </ul> + + </div> + +<div class="section"> +<h3><a name="Executing_the_Client"></a>Executing the Client</h3> + +<p> + Send the following request to http://localhost:8280/services/BuyAllProxy + using a tool such at <a class="externalLink" href="http://ws.apache.org/tcpmon/">TCPMon</a> or curl. + </p> + +<div class="xmlConf"><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"> + <soapenv:Body> + <buyItems xmlns="http://services.samples"> + <items> + <item> + <id>2150</id> + <quantity>1</quantity> + </item> + <item> + <id>1189</id> + <quantity>2</quantity> + </item> + <item> + <id>890</id> + <quantity>4</quantity> + </item> + </items> + </buyItems> + </soapenv:Body> +</soapenv:Envelope></div> + + +<p> + Each instance of the <i>ShoppingCart</i> stateful session bean hosted on the remote EJB container + maintains a state which keeps track of the number and the total price of the items + added via its <i>addItem(String itemId, int count)</i> method. The <i>float getTotal()</i> and + <i>int getItemCount()</i> methods are used to retrieve this state. + </p> + +<p> + When the <i>BuyAllProxy</i> receives the above request, it iterates over all <item> elements + in the request and calls the <i>addItem()</i> method on the <i>ShoppingCart</i> bean, + once per each <item>, using the EJB mediator. Since the <i>sessionId</i> used for these + invocations is actually the message ID, each request works on a new <i>ShoppingCart</i> instance + which is created at the first EJB mediator invocation in that request's flow. + </p> + +<p> + When all <i>addItem()</i> method calls are finished, <i>getItemCount()</i> and <i>getTotal()</i> methods + are invoked on the same <i>ShoppingCart</i> instance within the <i>collector</i> sequence and + results are stored in two message context properties named <i>ITEM_COUNT</i> and <i>TOTAL</i>. + The last EJB call on the shopping cart sets the EJB mediator attribute <i>remove = "true"</i> + instructing the current stateful bean stub to be removed from the beanstalk. This is because the + same stateful bean instance will not be used again (each request uses a new bean instance). If the + user does not explicitly remove the stub using this attribute, it will be removed automatically + upon timeout as specified by the beanstalk configuration. + </p> + +<p> + Finally, the PayloadFactory mediator is used to build the response message which is sent back to the + client. + </p> + +<p>A sample response is shown below.</p> + + +<div class="xmlConf"><?xml version="1.0" encoding="UTF-8"?> +<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"> + <soapenv:Body> + <buyAllResponse> + <itemCount>7</itemCount> + <total>807.0</total> + </buyAllResponse> + </soapenv:Body> +</soapenv:Envelope></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–2017 +<a href="http://www.apache.org/">Apache Software Foundation</a>. +All rights reserved.</p> + </div> + </div> + </footer> + </body> +</html> Added: synapse/site/3_0_1/userguide/samples/sample5.html URL: http://svn.apache.org/viewvc/synapse/site/3_0_1/userguide/samples/sample5.html?rev=1817077&view=auto ============================================================================== --- synapse/site/3_0_1/userguide/samples/sample5.html (added) +++ synapse/site/3_0_1/userguide/samples/sample5.html Mon Dec 4 09:53:57 2017 @@ -0,0 +1,214 @@ +<!DOCTYPE html> +<!-- + | Generated by Apache Maven Doxia Site Renderer 1.7.4 at 2017-12-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="20171204" /> + <meta http-equiv="Content-Language" content="en" /> + <title>Apache Synapse – Apache Synapse - Sample 5</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: 2017-12-04<span class="divider">|</span> +</li> + <li id="projectVersion">Version: 3.0.1</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_5:_Creating_SOAP_Faults_and_Changing_the_Direction_of_Messages"></a>Sample 5: Creating SOAP Faults and Changing the Direction of Messages</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/> + </sequence> + + <sequence name="main" onError="myFaultHandler"> + <in> + <switch xmlns:m0="http://services.samples" source="//m0:getQuote/m0:request/m0:symbol"> + <case regex="MSFT"> + <send> + <endpoint> + <address uri="http://bogus:9000/services/NonExistentStockQuoteService"/> + </endpoint> + </send> + </case> + <case regex="SUN"> + <send> + <endpoint> + <address uri="http://localhost:9009/services/NonExistentStockQuoteService"/> + </endpoint> + </send> + </case> + </switch> + <drop/> + </in> + + <out> + <send/> + </out> + </sequence> + +</definitions></div> + +<div class="section"> +<h3><a name="Objective"></a>Objective</h3> + +<p> + Demonstrating how makefault mediator can be used to construct custom SOAP + faults and change the direction (in/out) of messages. + </p> + </div> + +<div class="section"> +<h3><a name="Pre-requisites"></a>Pre-requisites</h3> + +<p> + </p> +<ul> + +<li> + Start Synapse using the configuration numbered 5 (repository/conf/sample/synapse_sample_5.xml) + +<div class="command"> + Unix/Linux: sh synapse.sh -sample 5<br /> + Windows: synapse.bat -sample 5 + </div> + </li> + </ul> + + </div> + +<div class="section"> +<h3><a name="Executing_the_Client"></a>Executing the Client</h3> + +<p> + When the MSFT stock quote is requested, an unknown host exception would be + generated. A connection refused exception would be generated for the SUN stock + request. These errors are captured and returned to the original client as a SOAP + fault in this example. + </p> + +<div class="command">ant stockquote -Daddurl=http://localhost:9000/services/SimpleStockQuoteService -Dtrpurl=http://localhost:8280/ -Dsymbol=MSFT</div> + +<p>returns,</p> + +<div class="consoleOutput"><soapenv:Fault xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"> + <faultcode>soapenv:Client</faultcode> + <faultstring>java.net.UnknownHostException: bogus</faultstring> + <detail /> +</soapenv:Fault></div> + +<p>And </p> + +<div class="command">ant stockquote -Daddurl=http://localhost:9000/services/SimpleStockQuoteService -Dtrpurl=http://localhost:8280/ -Dsymbol=SUN</div> + +<p>returns, </p> + +<div class="consoleOutput"><soapenv:Fault xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"> + <faultcode>soapenv:Client</faultcode> + <faultstring>java.net.ConnectException: Connection refused</faultstring> + <detail /> +</soapenv:Fault></div> + +<p> + Note that the response attribute is set to 'true' on the makefault mediator. + This instructs the mediator to change the direction of messages to 'response' + as messages are transformed into SOAP faults. + </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–2017 +<a href="http://www.apache.org/">Apache Software Foundation</a>. +All rights reserved.</p> + </div> + </div> + </footer> + </body> +</html> Added: synapse/site/3_0_1/userguide/samples/sample50.html URL: http://svn.apache.org/viewvc/synapse/site/3_0_1/userguide/samples/sample50.html?rev=1817077&view=auto ============================================================================== --- synapse/site/3_0_1/userguide/samples/sample50.html (added) +++ synapse/site/3_0_1/userguide/samples/sample50.html Mon Dec 4 09:53:57 2017 @@ -0,0 +1,199 @@ +<!DOCTYPE html> +<!-- + | Generated by Apache Maven Doxia Site Renderer 1.7.4 at 2017-12-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="20171204" /> + <meta http-equiv="Content-Language" content="en" /> + <title>Apache Synapse – Apache Synapse - Sample 50</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: 2017-12-04<span class="divider">|</span> +</li> + <li id="projectVersion">Version: 3.0.1</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_50:_POX_to_SOAP_Conversion"></a>Sample 50: POX to SOAP Conversion</h2> + +<div class="xmlConf"><definitions xmlns="http://ws.apache.org/ns/synapse"> + + <sequence name="main"> + <!-- filtering of messages with XPath and regex matches --> + <header name="Action" value="urn:getQuote"/> + <filter source="get-property('To')" regex=".*/StockQuote.*"> + <then> + <send> + <endpoint> + <address uri="http://localhost:9000/services/SimpleStockQuoteService" format="soap11"/> + </endpoint> + </send> + <drop/> + </then> + </filter> + <send/> + </sequence> + +</definitions></div> + +<div class="section"> +<h3><a name="Objective"></a>Objective</h3> + +<p> + Demonstrating how to convert a POX (Plain Old XML) message to a standard SOAP 1.1 + request. + </p> + </div> + +<div class="section"> +<h3><a name="Pre-requisites"></a>Pre-requisites</h3> + +<p> + </p> +<ul> + +<li> + Deploy the SimpleStockQuoteService in the sample Axis2 server and start Axis2 + </li> + +<li> + Start Synapse using the configuration numbered 50 (repository/conf/sample/synapse_sample_50.xml) + +<div class="command"> + Unix/Linux: sh synapse.sh -sample 50<br /> + Windows: synapse.bat -sample 50 + </div> + </li> + </ul> + + </div> + +<div class="section"> +<h3><a name="Executing_the_Client"></a>Executing the Client</h3> + +<p> + Execute the sample client as follows and send a plain XML getQuote request to + Synapse. + </p> + +<div class="command">ant stockquote -Dtrpurl=http://localhost:8280/services/StockQuote -Drest=true</div> + + +<p> + The request sent by the client will look something like this. + </p> + +<div class="consoleOutput">POST /services/StockQuote HTTP/1.1 +Content-Type: application/xml; charset=UTF-8;action="urn:getQuote"; +SOAPAction: urn:getQuote +User-Agent: Axis2 +Host: 127.0.0.1 +Transfer-Encoding: chunked + +75 +<m0:getQuote xmlns:m0="http://services.samples"> + <m0:request> + <m0:symbol>IBM</m0:symbol> + </m0:request> +</m0:getQuote>0</div> + +<p> + Note that this is simply an XML payload going over the HTTP connection. It is + not a SOAP envelope and hence the content type is set to application/xml. Synapse + will convert the above message to a valid SOAP 1.1 request and send to the sample + Axis2 server. The response from Axis2 will also be a SOAP message, which will + be converted back to POX format before sending back to the client. + </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–2017 +<a href="http://www.apache.org/">Apache Software Foundation</a>. +All rights reserved.</p> + </div> + </div> + </footer> + </body> +</html>