Author: supun Date: Mon Jun 29 23:31:58 2009 New Revision: 40368 URL: http://wso2.org/svn/browse/wso2?view=rev&revision=40368
Log: Updating samples Modified: trunk/esb/java/docs/xdoc/samples/advanced_mediation_samples.xml Modified: trunk/esb/java/docs/xdoc/samples/advanced_mediation_samples.xml URL: http://wso2.org/svn/browse/wso2/trunk/esb/java/docs/xdoc/samples/advanced_mediation_samples.xml?rev=40368&r1=40367&r2=40368&view=diff ============================================================================== --- trunk/esb/java/docs/xdoc/samples/advanced_mediation_samples.xml (original) +++ trunk/esb/java/docs/xdoc/samples/advanced_mediation_samples.xml Mon Jun 29 23:31:58 2009 @@ -1,4 +1,4 @@ -<?xml version="1.0" encoding="ISO-8859-1"?> +<?xml version="1.0" encoding="iso-8859-1"?> <!-- ~ Copyright (c) 2009, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. ~ @@ -16,18 +16,18 @@ ~ specific language governing permissions and limitations ~ under the License. --> - -<!DOCTYPE html - PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" - "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> - <meta content="text/html; charset=iso-8859-1" http-equiv="content-type"/> + <meta content="text/html; charset=iso-8859-1" http-equiv="content-type" /> <title>WSO2 ESB - Advanced Mediation Samples </title> </head> <body> -<h1>Running the Advanced Mediation samples with WSO2 Enterprise Service Bus (ESB) </h1> +<h1>Running the Advanced Mediation samples with WSO2 Enterprise Service Bus +(ESB) </h1> + <h2><a name="ScriptMediator">Using scripts in mediation (Script Mediator)</a> </h2> @@ -58,7 +58,6 @@ <send/> </out> </definitions> </pre> - <pre xml:space="preserve"><x><![CDATA[ function transformRequest(mc) { var symbol = mc.getPayloadXML()..*::Code.toString(); @@ -85,18 +84,18 @@ <p><strong>Prerequisites:</strong> </p> -<p>Start the Synapse configuration numbered 350: i.e. wso2esb-samples -sn 350<br -/> +<p>Start the Synapse configuration numbered 350: i.e. wso2esb-samples -sn +350<br /> Start the Axis2 server and deploy the SimpleStockQuoteService if not already done </p> <p>This sample is similar to sample 8 but instead of using XSLT the transformation is done with JavaScript and E4X. Note that the script source loaded from a resource must be specified within a CDATA tag within an XML -element. The script used in this example has two functions, -'transformRequest' and 'transformResponse', and the Synapse configuration -uses the function attribute to specify which function should be invoked. Use -the stock quote client to issue a custom quote client as follows.: </p> +element. The script used in this example has two functions, 'transformRequest' +and 'transformResponse', and the Synapse configuration uses the function +attribute to specify which function should be invoked. Use the stock quote +client to issue a custom quote client as follows.: </p> <pre xml:space="preserve">ant stockquote -Daddurl=http://localhost:9000/services/SimpleStockQuoteService -Dtrpurl=http://localhost:8280/ -Dmode=customquote</pre> <p>ESB uses the script mediator and the specified Javascript function to @@ -142,14 +141,14 @@ <p><strong>Prerequisites:</strong> </p> -<p>Start the Synapse configuration numbered 351: i.e. wso2esb-samples -sn 351<br -/> +<p>Start the Synapse configuration numbered 351: i.e. wso2esb-samples -sn +351<br /> Start the Axis2 server and deploy the SimpleStockQuoteService if not already done </p> -<p>This example is functionally equivalent to sample # 350 and sample # 8, -and demonstrates in-line script mediation in ESB. Use the stock quote client -to send a custom quote as in example # 350 to test this example. </p> +<p>This example is functionally equivalent to sample # 350 and sample # 8, and +demonstrates in-line script mediation in ESB. Use the stock quote client to +send a custom quote as in example # 350 to test this example. </p> <h2><a name="Sample352">Sample 352: Accessing Synapse message context API methods using scripting language</a> </h2> @@ -175,16 +174,16 @@ <p><strong>Prerequisites:</strong> </p> -<p>Start the Synapse configuration numbered 352: i.e. wso2esb-samples -sn 352<br /> +<p>Start the Synapse configuration numbered 352: i.e. wso2esb-samples -sn +352<br /> </p> -<p>This example shows how an inline JavaScript mediator script could access -the Synapse message context API to set its 'To' EPR and to set a custom -property to mark it as a response. Execute the stock quote client, and you -will receive the response "99.9" as the last sale price as per the above -script. </p> +<p>This example shows how an inline JavaScript mediator script could access the +Synapse message context API to set its 'To' EPR and to set a custom property to +mark it as a response. Execute the stock quote client, and you will receive the +response "99.9" as the last sale price as per the above script. </p> <pre xml:space="preserve">ant stockquote -Daddurl=http://localhost:9000/services/SimpleStockQuoteService -Dtrpurl=http://localhost:8280/ -... + ... stockquote: [java] Standard :: Stock price = $99.9</pre> @@ -233,19 +232,20 @@ <p><strong>Prerequisites:</strong> </p> -<p>This sample uses Ruby so first setup support for this in ESB as described -at <a href="../samples_setup_guide.html#script">Configuring JRuby</a>. </p> +<p>This sample uses Ruby so first setup support for this in ESB as described at +<a href="../samples_setup_guide.html#script">Configuring JRuby</a>. </p> -<p>Start the Synapse configuration numbered 353: i.e. wso2esb-samples -sn 353<br /> +<p>Start the Synapse configuration numbered 353: i.e. wso2esb-samples -sn +353<br /> Start the Axis2 server and deploy the SimpleStockQuoteService if not already done </p> <p>This sample is functionally equivalent to sample # 350 (#351 and #8) but instead uses a Ruby script using the JRuby interpreter. The script has two functions, 'transformRequest' and 'transformResponse', and the Synapse -configuration specifies which function is to be invoked when used. Execute -the stock quote client to send a custom stock quote as per example #350 and -check the received stock quote response. </p> +configuration specifies which function is to be invoked when used. Execute the +stock quote client to send a custom stock quote as per example #350 and check +the received stock quote response. </p> <h2><a name="Sample354">Sample 354: Using In-lined Ruby scripts for mediation</a> </h2> @@ -290,10 +290,11 @@ <p><strong>Prerequisites:</strong> </p> -<p>This sample uses Ruby so first setup support for this in ESB as described -at <a href="../samples_setup_guide.html#script">Configuring JRuby</a>. </p> +<p>This sample uses Ruby so first setup support for this in ESB as described at +<a href="../samples_setup_guide.html#script">Configuring JRuby</a>. </p> -<p>Start the Synapse configuration numbered 354: i.e. wso2esb-samples -sn 354<br /> +<p>Start the Synapse configuration numbered 354: i.e. wso2esb-samples -sn +354<br /> Start the Axis2 server and deploy the SimpleStockQuoteService if not already done </p> @@ -306,9 +307,9 @@ DBReport)</a> </h2> <p>Following database mediators use Derby in a client/server configuration by -using the network server. Therefore, to proceed with the following samples, -you need a working Derby database server and you have to follow the steps in -<a href="../samples_setup_guide.html#derby">Sample Setup Guide</a> before going +using the network server. Therefore, to proceed with the following samples, you +need a working Derby database server and you have to follow the steps in <a +href="../samples_setup_guide.html#derby">Sample Setup Guide</a> before going through the samples. </p> <h2><a name="Sample360">Sample 360: Introduction to dblookup mediator</a> </h2> @@ -409,8 +410,7 @@ </definitions></pre> -<p><strong>Objective:Introduction to the dblookup -mediator</strong> </p> +<p><strong>Objective:Introduction to the dblookup mediator</strong> </p> <p><strong>Prerequisites:</strong> Setting up Derby database as explained above. </p> @@ -418,17 +418,17 @@ <p>Start the Synapse configuration numbered 360: i.e. wso2esb-samples -sn 360 </p> -<p>Start the Axis2 server and deploy the SimpleStockQuoteService if not -already done </p> +<p>Start the Axis2 server and deploy the SimpleStockQuoteService if not already +done </p> -<p>This sample demonstrates simple database read operations through ESB. When -a message arrives at dblookup mediator, it opens a connection to the database -and executes the SQL query. The SQL query use '?' 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 evaluated using an xpath against the SOAP envelope. Then 'id' -base switching will be done by a switch mediator. </p> +<p>This sample demonstrates simple database read operations through ESB. When a +message arrives at dblookup mediator, it opens a connection to the database and +executes the SQL query. The SQL query use '?' 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 evaluated using an xpath against the SOAP envelope. Then 'id' base switching +will be done by a switch mediator. </p> <p>When the IBM stock quote is requested, </p> <pre xml:space="preserve">ant stockquote -Daddurl=http://localhost:9000/services/SimpleStockQuoteService -Dtrpurl=http://localhost:8280/ -Dsymbol=IBM</pre> @@ -483,10 +483,10 @@ </connection> <statement> <sql>update company set price=? where name =?</sql> - <parameter expression="//m0:return/m0:last/child::text()" - xmlns:m0="http://services.samples/xsd" type="DOUBLE"/> - <parameter expression="//m0:return/m0:symbol/child::text()" - xmlns:m0="http://services.samples/xsd" type="VARCHAR"/> + <parameter expression="//m0:return/m1:last/child::text()" + xmlns:m0="http://services.samples" xmlns:m1="http://services.samples/xsd" type="DOUBLE"/> + <parameter expression="//m0:return/m1:symbol/child::text()" + xmlns:m0="http://services.samples" xmlns:m1="http://services.samples/xsd" type="VARCHAR"/> </statement> </dbreport> <send/> @@ -496,26 +496,24 @@ </definitions></pre> <div> -<p><strong>Objective: Introduction to the dbreport -mediator</strong> </p> +<p><strong>Objective: Introduction to the dbreport mediator</strong> </p> <p><strong>Prerequisites:</strong> Setting up Derby database as above. </p> <p>Start the Synapse configuration numbered 361: i.e. wso2esb-samples -sn 361 </p> -<p>Start the Axis2 server and deploy the SimpleStockQuoteService if not -already done </p> +<p>Start the Axis2 server and deploy the SimpleStockQuoteService if not already +done </p> </div> <p>This sample demonstrate simple database write operations. The dbreport -mediator writes (i.e. inserts one row) to a table using the message details. -It works the same 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 inserted value by the dbreport -mediator. </p> +mediator writes (i.e. inserts one row) to a table using the message details. It +works the same 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 inserted value by the dbreport mediator. </p> <p>Run the client using, </p> <pre xml:space="preserve">ant stockquote -Daddurl=http://localhost:9000/services/SimpleStockQuoteService -Dtrpurl=http://localhost:8280/ -Dsymbol=IBM</pre> @@ -560,10 +558,10 @@ </connection> <statement> <sql>update company set price=? where name =?</sql> - <parameter expression="//m0:return/m0:last/child::text()" - xmlns:m0="http://services.samples/xsd" type="DOUBLE"/> - <parameter expression="//m0:return/m0:symbol/child::text()" - xmlns:m0="http://services.samples/xsd" type="VARCHAR"/> + <parameter expression="//m0:return/m1:last/child::text()" + xmlns:m0="http://services.samples" xmlns:m1="http://services.samples/xsd" type="DOUBLE"/> + <parameter expression="//m0:return/m1:symbol/child::text()" + xmlns:m0="http://services.samples/xsd" xmlns:m1="http://services.samples/xsd" type="VARCHAR"/> </statement> </dbreport> <log level="custom"> @@ -581,8 +579,8 @@ </connection> <statement> <sql>select * from company where name =?</sql> - <parameter expression="//m0:return/m0:symbol/child::text()" - xmlns:m0="http://services.samples/xsd" type="VARCHAR"/> + <parameter expression="//m0:return/m1:symbol/child::text()" + xmlns:m0="http://services.samples/xsd" xmlns:m1="http://services.samples/xsd" type="VARCHAR"/> <result name="stock_price" column="price"/> </statement> </dblookup> @@ -604,13 +602,13 @@ <p>Start the Synapse configuration numbered 362: i.e. wso2esb-samples -sn 362 </p> -<p>Start the Axis2 server and deploy the SimpleStockQuoteService if not -already done </p> +<p>Start the Axis2 server and deploy the SimpleStockQuoteService if not already +done </p> -<p>In this sample ,the dbreport mediator works the same as the above sample. -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. </p> +<p>In this sample ,the dbreport mediator works the same as the above sample. 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. </p> <p>When running client, </p> <pre xml:space="preserve">ant stockquote -Daddurl=http://localhost:9000/services/SimpleStockQuoteService -Dtrpurl=http://localhost:8280/ -Dsymbol=IBM</pre> @@ -727,10 +725,10 @@ </connection> <statement> <sql>update company set price=? where name =?</sql> - <parameter expression="//m0:return/m0:last/child::text()" - xmlns:m0="http://services.samples/xsd" type="DOUBLE"/> - <parameter expression="//m0:return/m0:symbol/child::text()" - xmlns:m0="http://services.samples/xsd" type="VARCHAR"/> + <parameter expression="//m0:return/m1:last/child::text()" + xmlns:m0="http://services.samples" xmlns:m1="http://services.samples/xsd" type="DOUBLE"/> + <parameter expression="//m0:return/m1:symbol/child::text()" + xmlns:m0="http://services.samples" xmlns:m1="http://services.samples/xsd" type="VARCHAR"/> </statement> </dbreport> <log level="custom"> @@ -749,8 +747,8 @@ </connection> <statement> <sql>select * from company where name =?</sql> - <parameter expression="//m0:return/m0:symbol/child::text()" - xmlns:m0="http://services.samples/xsd" type="VARCHAR"/> + <parameter expression="//m0:return/m1:symbol/child::text()" + xmlns:m0="http://services.samples" xmlns:m1="http://services.samples/xsd" type="VARCHAR"/> <result name="stock_price" column="price"/> </statement> </dblookup> @@ -765,23 +763,24 @@ </sequence> </definitions></pre> + <p><strong>Objective:</strong> Demonstrate the use of reusable database connection pools</p> <p><strong>Prerequisites:</strong> Setting up DataBase and DataSources according to the sample setup guide.</p> -<p>Start the Synapse configuration numbered 363: i.e. wso2esb-samples -sn 363</p> +<p>Start the Synapse configuration numbered 363: i.e. wso2esb-samples -sn +363</p> -<p>Start the Axis2 server and deploy the SimpleStockQuoteService if not -already done</p> +<p>Start the Axis2 server and deploy the SimpleStockQuoteService if not already +done</p> <p>Runs the client as follows</p> <pre>ant stockquote -Daddurl=http://localhost:9000/services/SimpleStockQuoteService -Dtrpurl=http://localhost:8280/</pre> <p>Then the console output</p> -<pre> - INFO LogMediator text = ** Looking up from the Database ** +<pre> INFO LogMediator text = ** Looking up from the Database ** ... INFO LogMediator text = Company ID - c1 ... @@ -791,8 +790,7 @@ ... INFO LogMediator text = Stock price - 183.3635460215262</pre> - -<h2><a name="Throttle"/></h2> +<h2><a name="Throttle"></a></h2> <h2><a name="Throttle1">Throttling messages (Throttle Mediator)</a> </h2> @@ -844,8 +842,8 @@ </sequence> </definitions></pre> -<p><strong>Objective: </strong>Demonstrate the use of throttle mediator for concurrency -throttling</p> +<p><strong>Objective: </strong>Demonstrate the use of throttle mediator for +concurrency throttling</p> <p><strong>Prerequisites:</strong> </p> @@ -856,16 +854,16 @@ </p> <p>Above configuration specifies a throttle mediator inside the in mediator. -Therefore, all request messages directed to the main sequence will be -subjected to throttling. Throttle mediator has 'policy', 'onAccept' and -'onReject' tags at top level. The 'policy' tag specifies the throttling policy for -throttling messages. This sample policy only contains a component called +Therefore, all request messages directed to the main sequence will be subjected +to throttling. Throttle mediator has 'policy', 'onAccept' and 'onReject' tags +at top level. The 'policy' tag specifies the throttling policy for throttling +messages. This sample policy only contains a component called "MaximumConcurrentAccess" .This indicates the maximum number of concurrent -requests that can pass through Synapse on a single -unit of time. To test concurrency throttling, it is required to send -concurrent requests to Synapse. If Synapse with above configuration, receives -20 requests concurrently from clients, then approximately half of those will -succeed while the others being throttled. The client command to try this is as follows.</p> +requests that can pass through Synapse on a single unit of time. To test +concurrency throttling, it is required to send concurrent requests to Synapse. +If Synapse with above configuration, receives 20 requests concurrently from +clients, then approximately half of those will succeed while the others being +throttled. The client command to try this is as follows.</p> <pre xml:space="preserve">ant stockquote -Dsymbol=IBM -Dmode=quote -Daddurl=http://localhost:8280/</pre> <h2><a name="Sample371">Sample 371: Restricting requests based on policies </a> @@ -941,8 +939,8 @@ </sequence> </definitions></pre> -<p><strong>Objective: Demonstrate the use of throttle mediator for -restricting request counts</strong> </p> +<p><strong>Objective: Demonstrate the use of throttle mediator for restricting +request counts</strong> </p> <p><strong>Prerequisites:</strong> </p> @@ -953,15 +951,15 @@ </p> <p>Above configuration specifies a throttle mediator inside the in mediator. -Therefore, all request messages directed to the main sequence will be -subjected to throttling. Throttle mediator has policy, onAccept and onReject -tags at the top level. Policy tag specifies the throttling policy to be -applied for messages. It contains some IP address ranges and the maximum -number of messages to be allowed for those ranges within a time period given -in "UnitTime" tag. "ProhibitTimePeriod" tag specifies the time period to -prohibit further requests after the received request count exceeds the -specified time. Now run the client 5 times repetitively using the following -command to see how throttling works. </p> +Therefore, all request messages directed to the main sequence will be subjected +to throttling. Throttle mediator has policy, onAccept and onReject tags at the +top level. Policy tag specifies the throttling policy to be applied for +messages. It contains some IP address ranges and the maximum number of messages +to be allowed for those ranges within a time period given in "UnitTime" tag. +"ProhibitTimePeriod" tag specifies the time period to prohibit further requests +after the received request count exceeds the specified time. Now run the client +5 times repetitively using the following command to see how throttling works. +</p> <pre xml:space="preserve">ant stockquote -Dsymbol=IBM -Dmode=quote -Daddurl=http://localhost:8280/</pre> <p>For the first four requests you will get the quote prices for IBM as @@ -971,10 +969,10 @@ <p>You will receive the following response for the fifth request. </p> <pre xml:space="preserve">[java] org.apache.axis2.AxisFault: **Access Denied**</pre> -<p>Maximum number of requests within 800000 milliseconds is specified as 4 -for any server (including localhost) other than the explicitly specified -ones. Therefore, our fifth request is denied by the throttle mediator. You -can verify this by looking at the ESB console. </p> +<p>Maximum number of requests within 800000 milliseconds is specified as 4 for +any server (including localhost) other than the explicitly specified ones. +Therefore, our fifth request is denied by the throttle mediator. You can verify +this by looking at the ESB console. </p> <pre xml:space="preserve">[HttpServerWorker-1] INFO LogMediator - text = **Access Accept** [HttpServerWorker-2] INFO LogMediator - text = **Access Accept** [HttpServerWorker-3] INFO LogMediator - text = **Access Accept** @@ -1036,20 +1034,20 @@ <div> </div> -<p><strong>Objective: Use of both concurrency throttling and request rate -based throttling </strong> </p> +<p><strong>Objective: Use of both concurrency throttling and request rate based +throttling </strong> </p> -<p><strong>Prerequisites:</strong> Deploy the SimpleStockQuoteService in -sample Axis2 server and start it on port 9000. </p> +<p><strong>Prerequisites:</strong> Deploy the SimpleStockQuoteService in sample +Axis2 server and start it on port 9000. </p> <p>Start ESB with the sample configuration 372 (i.e. wso2esb-samples -sn 372). </p> -<p>Throttle policy is loaded from the ?throttle_policy.xml? -.That policy contains merging policy from sample 370 and 371. To check the -functionality , it is need to run load test.The all enabled request from the -concurrency throttling will be controlled by the access rate base throttling -according to the policy. </p> +<p>Throttle policy is loaded from the ?throttle_policy.xml? .That policy +contains merging policy from sample 370 and 371. To check the functionality , +it is need to run load test.The all enabled request from the concurrency +throttling will be controlled by the access rate base throttling according to +the policy. </p> <p>Run the client as follows </p> <pre xml:space="preserve">ant stockquote -Daddurl=http://localhost:8280/services/StockQuoteProxy</pre> @@ -1064,8 +1062,8 @@ <p>Class mediator can be used to write your own custom mediation in Java and you have access to the SynapseMessageContext and to the full Synapse API in there. This is a useful extension mechanism within ESB to extend its -functionality. This class can contain fields for which you can assign values -at runtime through the configuration. </p> +functionality. This class can contain fields for which you can assign values at +runtime through the configuration. </p> <h2><a name="Sample380">Sample 380: Writing your own custom mediation in Java</a> </h2> @@ -1103,8 +1101,8 @@ <p><strong>Prerequisites:</strong> </p> -<p>Make sure the synapse-samples-1.0.jar is in your class path (by default -this jar is placed in the lib directory when installing ESB). </p> +<p>Make sure the synapse-samples-1.0.jar is in your class path (by default this +jar is placed in the lib directory when installing ESB). </p> <p>Start ESB with the sample configuration 380 (i.e. wso2esb-samples -sn 380) </p> @@ -1114,8 +1112,8 @@ <p>In this configuration, ESB hands over the request message to the specified endpoint, which sends it to the Axis2 server running on port 9000. </p> -<p>But the response message is passed through the class mediator before -sending it back to the client. Two parameters named "discountFactor" </p> +<p>But the response message is passed through the class mediator before sending +it back to the client. Two parameters named "discountFactor" </p> <p>and "bonusFor" are passed to the instance mediator implementation class (i.e. samples.mediators.DiscountQuoteMediator) before each </p> @@ -1209,13 +1207,13 @@ <p>All classes developed for class mediation should implement the Mediator interface, which contains the mediate(...) method. mediate(...) method of the above class is invoked for each response message mediated through the main -sequence, with the message context of the current message as the parameter. -All the details of the message including the SOAP headers, SOAP body and -properties of the context hierarchy can be accessed from the message context. -In this sample, the body of the message is retrieved and the discount -percentage is subtracted from the quote price. If the quote request number is -less than the number specified in the "bonusFor" property in the -configuration, a special discount is given. </p> +sequence, with the message context of the current message as the parameter. All +the details of the message including the SOAP headers, SOAP body and properties +of the context hierarchy can be accessed from the message context. In this +sample, the body of the message is retrieved and the discount percentage is +subtracted from the quote price. If the quote request number is less than the +number specified in the "bonusFor" property in the configuration, a special +discount is given. </p> <p>Now run the client using the following command. </p> <pre xml:space="preserve">ant stockquote -Dsymbol=IBM -Dmode=quote -Daddurl=http://localhost:8280</pre> @@ -1279,8 +1277,8 @@ </definitions> </pre> <p>This example uses the XQuery mediator to perform transformations. This -sample behaves the same as sample number 8 and the only difference is that -this sample uses XQuery instead of XSLT for transformation. </p> +sample behaves the same as sample number 8 and the only difference is that this +sample uses XQuery instead of XSLT for transformation. </p> <p>Execute the custom quote client as 'ant stockquote -Dmode=customquote ...' </p> @@ -1321,11 +1319,11 @@ </proxy> </definitions></pre> -<p><strong>Objective: Demonstrate the use of XQuery mediator to import -external XML documents to the XQuery engine</strong></p> +<p><strong>Objective: Demonstrate the use of XQuery mediator to import external +XML documents to the XQuery engine</strong></p> -<p><strong>Prerequisites:</strong>Deploy the SimpleStockQuoteService in -sample Axis2 server and start it on port 9000. </p> +<p><strong>Prerequisites:</strong>Deploy the SimpleStockQuoteService in sample +Axis2 server and start it on port 9000. </p> <p>Start ESB with the sample configuration 391 (i.e. wso2esb-samples -sn 391). </p> @@ -1378,8 +1376,8 @@ messages in to parts and process them asynchronously and then aggregate the responses coming in to ESB</strong></p> -<p><strong>Prerequisites:</strong>Deploy the SimpleStockQuoteService in -sample Axis2 server and start it on port 9000. </p> +<p><strong>Prerequisites:</strong>Deploy the SimpleStockQuoteService in sample +Axis2 server and start it on port 9000. </p> <p>Start ESB with the sample configuration 400 (i.e. wso2esb-samples -sn 400). </p> @@ -1387,8 +1385,8 @@ <p>In this sample, the message sent to ESB has embedded with a number of elements of the same type in one message. When ESB received this message it will iterate through those elements and then sent to the specified endpoint. -When all the responses appear in to ESB then those messages will be -aggregated to form the resultant response and sent back to the client. </p> +When all the responses appear in to ESB then those messages will be aggregated +to form the resultant response and sent back to the client. </p> <p>Invoke the client as follows. </p> <pre xml:space="preserve">ant stockquote -Daddurl=http://localhost:8280/services/SplitAggregateProxy -Ditr=4</pre> @@ -1396,12 +1394,12 @@ <h2><a name="Cache">Caching the responses over the requests (Cache Mediator)</a> </h2> -<p>Cache mediator can be used to utilize the network bandwidth, to protect -the backend service from being loaded with the same type of requests like -browser refresh actions and also to speed up the execution of the web -service. This mediator should be used with sence, because it is not -applicable for each and every service (for example services with dynamic -responses for a particular release) </p> +<p>Cache mediator can be used to utilize the network bandwidth, to protect the +backend service from being loaded with the same type of requests like browser +refresh actions and also to speed up the execution of the web service. This +mediator should be used with sence, because it is not applicable for each and +every service (for example services with dynamic responses for a particular +release) </p> <h2><a name="Sample420">Sample 420: Simple cache implemented on ESB for the actual service</a> </h2> @@ -1423,31 +1421,31 @@ </out> </definitions></pre> -<p><strong>Objective: Demonstrate the use of Cache mediator in order to -cache the response and use that cached response as the response for an -identical xml request</strong></p> +<p><strong>Objective: Demonstrate the use of Cache mediator in order to cache +the response and use that cached response as the response for an identical xml +request</strong></p> -<p><strong>Prerequisites:</strong>Deploy the SimpleStockQuoteService in -sample Axis2 server and start it on port 9000. </p> +<p><strong>Prerequisites:</strong>Deploy the SimpleStockQuoteService in sample +Axis2 server and start it on port 9000. </p> <p>Start ESB with the sample configuration 420 (i.e. wso2esb-samples -sn 420). </p> <p>In this sample, the message sent to ESB is checked for an existing cached -response by calculating the hash value of the request. If there is a cache -hit in ESB then this request will not be forwarded to the actual service, -rather ESB respond to the client with the cached response. In case of a cache -miss that particular message will be forwarded to the actual service and -cached that response in the out path for the use of consecutive requests of -the same type. </p> +response by calculating the hash value of the request. If there is a cache hit +in ESB then this request will not be forwarded to the actual service, rather +ESB respond to the client with the cached response. In case of a cache miss +that particular message will be forwarded to the actual service and cached that +response in the out path for the use of consecutive requests of the same type. +</p> <p>To observe this behaviour, invoke the client as follows. </p> <pre xml:space="preserve">ant stockquote -Dtrpurl=http://localhost:8280/</pre> <p>You could notice that if you send more than one requests within 20 seconds -only the first request is forwarded to the actual service, and the rest of -the requests will be served by the cache inside ESB. You could observe this -by looking at the printed line of the axis2 server, as well as by observing a +only the first request is forwarded to the actual service, and the rest of the +requests will be served by the cache inside ESB. You could observe this by +looking at the printed line of the axis2 server, as well as by observing a constant rate as the response to the client instead of the random rate, which changes by each and every 20 seconds.<br /> </p> @@ -1456,16 +1454,14 @@ </a> </h2> <p>The Callout mediator calls the given service URL with the request message -which is given by the source attribute, waits for the response and attaches -the received response to the destination which is given by the target -attribute. Both the source and the target can be a key or an XPath. In the -case of the source, this key refers to either a message context property or -to a local entry. For the target, this key refers to a message context -property only.</p> +which is given by the source attribute, waits for the response and attaches the +received response to the destination which is given by the target attribute. +Both the source and the target can be a key or an XPath. In the case of the +source, this key refers to either a message context property or to a local +entry. For the target, this key refers to a message context property only.</p> <h2><a name="Sample430">Sample 430: Simple Callout Mediator for synchronizing web service invocation</a> </h2> - <pre xml:space="preserve"> <!-- Simple callout mediator --> <definitions xmlns="http://ws.apache.org/ns/synapse"> <callout serviceURL="http://localhost:9000/services/SimpleStockQuoteService" @@ -1484,21 +1480,22 @@ </definitions> </pre> <div> -<p><strong>Objective:</strong> Demonstrate the use of the Callout mediator -for the synchronized web service invocation </p> +<p><strong>Objective:</strong> Demonstrate the use of the Callout mediator for +the synchronized web service invocation </p> -<p><strong>Prerequisites:</strong> Deploy the SimpleStockQuoteService in -sample Axis2 server and start it on port 9000. </p> +<p><strong>Prerequisites:</strong> Deploy the SimpleStockQuoteService in sample +Axis2 server and start it on port 9000. </p> -<p>Start Synapse with the sample configuration 430 (i.e. wso2esb-samples -sn 430). </p> +<p>Start Synapse with the sample configuration 430 (i.e. wso2esb-samples -sn +430). </p> <p>In this sample, Callout mediator does the direct service invocation to the -StockQuoteService using the client request, get the response and set it as -the first child of the SOAP message body. Then using the send mediator, the -message is sent back to the client. </p> +StockQuoteService using the client request, get the response and set it as the +first child of the SOAP message body. Then using the send mediator, the message +is sent back to the client. </p> <p>Invoke the client as follows. </p> <pre xml:space="preserve">ant stockquote -Daddurl=http://localhost:9000/services/SimpleStockQuoteService -Dtrpurl=http://localhost:8280/</pre> </div> </body> -</html> \ No newline at end of file +</html> _______________________________________________ Esb-java-dev mailing list [email protected] https://wso2.org/cgi-bin/mailman/listinfo/esb-java-dev
