Author: hiranya
Date: Sun Sep 26 06:12:09 2010
New Revision: 1001366
URL: http://svn.apache.org/viewvc?rev=1001366&view=rev
Log:
Fixing a sample
Modified:
synapse/branches/2.0/repository/conf/sample/synapse_sample_362.xml
synapse/branches/2.0/src/site/xdoc/Synapse_Samples.xml
Modified: synapse/branches/2.0/repository/conf/sample/synapse_sample_362.xml
URL:
http://svn.apache.org/viewvc/synapse/branches/2.0/repository/conf/sample/synapse_sample_362.xml?rev=1001366&r1=1001365&r2=1001366&view=diff
==============================================================================
--- synapse/branches/2.0/repository/conf/sample/synapse_sample_362.xml
(original)
+++ synapse/branches/2.0/repository/conf/sample/synapse_sample_362.xml Sun Sep
26 06:12:09 2010
@@ -68,8 +68,9 @@
</connection>
<statement>
<sql>select * from company where name =?</sql>
- <parameter xmlns:m0="http://services.samples/xsd"
-
expression="//m0:return/m0:symbol/child::text()" type="VARCHAR"/>
+ <parameter xmlns:m1="http://services.samples/xsd"
+ xmlns:m0="http://services.samples"
+
expression="//m0:return/m1:symbol/child::text()" type="VARCHAR"/>
<result name="stock_price" column="price"/>
</statement>
</dblookup>
Modified: synapse/branches/2.0/src/site/xdoc/Synapse_Samples.xml
URL:
http://svn.apache.org/viewvc/synapse/branches/2.0/src/site/xdoc/Synapse_Samples.xml?rev=1001366&r1=1001365&r2=1001366&view=diff
==============================================================================
--- synapse/branches/2.0/src/site/xdoc/Synapse_Samples.xml (original)
+++ synapse/branches/2.0/src/site/xdoc/Synapse_Samples.xml Sun Sep 26 06:12:09
2010
@@ -3240,7 +3240,7 @@ require 'rexml/document'
include REXML
def transformRequest(mc)
- newRequest= Document.new '<m:getQuote
xmlns:m="http://services.samples/xsd">'<<
+ newRequest= Document.new '<m:getQuote
xmlns:m="http://services.samples">'<<
'<m:request><m:symbol></m:symbol></m:request></m:getQuote>'
newRequest.root.elements[1].elements[1].text =
mc.getPayloadXML().root.elements[1].get_text
mc.setPayloadXML(newRequest)
@@ -3274,7 +3274,7 @@ end
<![CDATA[
require 'rexml/document'
include REXML
- newRequest= Document.new '<m:getQuote
xmlns:m="http://services.samples/xsd"><m:request><m:symbol>...test...</m:symbol></m:request></m:getQuote>'
+ newRequest= Document.new '<m:getQuote
xmlns:m="http://services.samples"><m:request><m:symbol>...test...</m:symbol></m:request></m:getQuote>'
newRequest.root.elements[1].elements[1].text =
$mc.getPayloadXML().root.elements[1].get_text
$mc.setPayloadXML(newRequest)
]]>
@@ -3485,10 +3485,11 @@ end
<div>
<p>
<strong>Objective:Introduction to the dbreport mediator</strong> </p>
+<p>
<strong>Prerequisites:</strong>
<br/>Setting up Derby database as above.
<br/>Start the Synapse configuration numbered 361: i.e. synapse -sample 361
-<br/>Start the Axis2 server and deploy the SimpleStockQuoteService if not
already done</div>
+<br/>Start the Axis2 server and deploy the SimpleStockQuoteService if not
already done</p></div>
<p>This sample demonstrates 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>
<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>
@@ -3499,63 +3500,64 @@ end
<p/>
<h2>
<a name="Sample362" id="Sample362">Sample 362: Action of dbreport and dblookup
mediators together</a></h2>
-<pre xml:space="preserve"><definitions
xmlns="http://synapse.apache.org/ns/2010/04/configuraiton">
+<pre xml:space="preserve"><definitions
xmlns="http://synapse.apache.org/ns/2010/04/configuration">
- <sequence name="main">
+ <sequence name="main" trace="enable">
<in>
<send>
<endpoint>
- <address
uri="http://localhost:9000/services/SimpleStockQuoteService"/>
+ <address
uri="http://localhost:9000/services/SimpleStockQuoteService"/>
</endpoint>
</send>
</in>
<out>
- <log level="custom">
- <property name="text"
- value="** Reporting to the Database
**"/>
+ <log level="custom">
+ <property name="text" value="** Reporting to the Database
**"/>
</log>
- <dbreport
xmlns="http://synapse.apache.org/ns/2010/04/configuraiton">
+ <dbreport>
<connection>
<pool>
-
<driver>org.apache.derby.jdbc.ClientDriver</driver>
-
<url>jdbc:derby://localhost:1527/synapsedb;create=false</url>
- <user>synapse</user>
- <password>synapse</password>
+ <driver>com.mysql.jdbc.Driver</driver>
+
<url>jdbc:mysql://localhost:3306/synapsedb</url>
+ <user>root</user>
+ <password>root123</password>
</pool>
</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 xmlns:m1="http://services.samples/xsd"
+ xmlns:m0="http://services.samples"
+ expression="//m0:return/m1:last/child::text()"
type="DOUBLE"/>
+ <parameter xmlns:m1="http://services.samples/xsd"
+ xmlns:m0="http://services.samples"
+
expression="//m0:return/m1:symbol/child::text()" type="VARCHAR"/>
</statement>
</dbreport>
- <log level="custom">
- <property name="text"
- value="** Looking up from the Database
**"/>
+ <log level="custom">
+ <property name="text" value="** Looking up from the
Database **"/>
</log>
- <dblookup
xmlns="http://synapse.apache.org/ns/2010/04/configuraiton">
+ <dblookup>
<connection>
<pool>
-
<driver>org.apache.derby.jdbc.ClientDriver</driver>
-
<url>jdbc:derby://localhost:1527/synapsedb;create=false</url>
- <user>synapse</user>
- <password>synapse</password>
+ <driver>com.mysql.jdbc.Driver</driver>
+
<url>jdbc:mysql://localhost:3306/synapsedb</url>
+ <user>root</user>
+ <password>root123</password>
</pool>
</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"/>
- <result name="stock_price"
column="price"/>
+ <parameter xmlns:m1="http://services.samples/xsd"
+ xmlns:m0="http://services.samples"
+
expression="//m0:return/m1:symbol/child::text()" type="VARCHAR"/>
+ <result name="stock_price" column="price"/>
</statement>
</dblookup>
- <log level="custom">
- <property name="text"
- expression="fn:concat('Stock price -
',get-property('stock_price'))"/>
+ <log level="custom">
+ <property name="text"
+ expression="fn:concat('Stock price -
',get-property('stock_price'))"/>
</log>
<send/>
</out>