Author: indika
Date: Tue Dec 18 00:27:17 2007
New Revision: 11351
Log:
fix an issue when binding an external basic variable whose value is expression
update a sample to include above functionality and also update document
Modified:
trunk/esb/java/modules/distribution/src/main/docs/ESB_Samples.html
trunk/esb/java/repository/conf/sample/resources/xquery/xquery_res.xq
trunk/esb/java/repository/conf/sample/synapse_sample_390.xml
Modified: trunk/esb/java/modules/distribution/src/main/docs/ESB_Samples.html
==============================================================================
--- trunk/esb/java/modules/distribution/src/main/docs/ESB_Samples.html
(original)
+++ trunk/esb/java/modules/distribution/src/main/docs/ESB_Samples.html Tue Dec
18 00:27:17 2007
@@ -2208,7 +2208,7 @@
<send/>
</sequence>
-</definitions> </pre>
+</definitions> </pre>
</div>
<p><strong>Objective: Load Balancing with Proxy Service</strong></p>
@@ -4026,10 +4026,11 @@
<h2><a name="Sample390">Sample 390: Introduction to the XQuery
mediator</a></h2>
-<pre><definitions xmlns="http://ws.apache.org/ns/synapse">
+<pre> <!-- Introduction to the XQuery mediator -->
+<definitions xmlns="http://ws.apache.org/ns/synapse">
<!-- the SimpleURLRegistry allows access to a URL based registry (e.g.
file:/// or http://) -->
- <registry
provider="org.apache.synapse.registry.url.SimpleURLRegistry">
+ <registry provider="org.wso2.esb.registry.ESBRegistry">
<!-- the root property of the simple URL registry helps resolve a
resource URL as root + key -->
<parameter
name="root">file:repository/conf/sample/resources/</parameter>
<!-- all resources loaded from the URL registry would be cached for
this number of milli seconds -->
@@ -4052,26 +4053,22 @@
</inSequence>
<outSequence>
<out>
- <xquery key="xquery/xquery_res.xq">
+ <xquery key="xquery/xquery_res.xq">
<variable name="payload" type="ELEMENT"/>
+ <variable name="code" type="STRING"
+
expression="self::node()//m0:return/m0:symbol/child::text()"
+ xmlns:m0="http://services.samples/xsd"/>
+ <variable name="price" type="DOUBLE"
+
expression="self::node()//m0:return/m0:last/child::text()"
+ xmlns:m0="http://services.samples/xsd"/>
</xquery>
- <send/>
+ <send/>
</out>
</outSequence>
</target>
- <publishWSDL
uri="file:repository/conf/sample/resources/proxy/sample_proxy_1.wsdl"/></proxy></definitions>
</pre>
-
-<p></p>
-
-<p><b>Objective: Introduction transformation using XQuery mediator</b></p>
-
-<p><b>Prerequisites</b>:Start the Synapse configuration numbered 390: i.e.
-wso2-esb -sample 390 </p>
-
-<p>Start the Axis2 server and deploy the SimpleStockQuoteService if not
-already done.</p>
-
-<p></p>
+ <publishWSDL
uri="file:repository/conf/sample/resources/proxy/sample_proxy_1.wsdl"/>
+ </proxy>
+</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
Modified: trunk/esb/java/repository/conf/sample/resources/xquery/xquery_res.xq
==============================================================================
--- trunk/esb/java/repository/conf/sample/resources/xquery/xquery_res.xq
(original)
+++ trunk/esb/java/repository/conf/sample/resources/xquery/xquery_res.xq
Tue Dec 18 00:27:17 2007
@@ -1,8 +1,10 @@
<x><![CDATA[
declare namespace m0="http://services.samples/xsd";
declare variable $payload as document-node() external;
+ declare variable $code as xs:string external;
+ declare variable $price as xs:double external;
<m:CheckPriceResponse xmlns:m="http://services.samples/xsd">
- <m:Code>{$payload//m0:return/m0:symbol/child::text()}</m:Code>
- <m:Price>{$payload//m0:return/m0:last/child::text()}</m:Price>
- </m:CheckPriceResponse>
+ <m:Code>{$code}</m:Code>
+ <m:Price>{$price}</m:Price>
+ </m:CheckPriceResponse>
]]></x>
\ No newline at end of file
Modified: trunk/esb/java/repository/conf/sample/synapse_sample_390.xml
==============================================================================
--- trunk/esb/java/repository/conf/sample/synapse_sample_390.xml
(original)
+++ trunk/esb/java/repository/conf/sample/synapse_sample_390.xml Tue Dec
18 00:27:17 2007
@@ -44,14 +44,19 @@
</inSequence>
<outSequence>
<out>
- <xquery key="xquery/xquery_res.xq">
+ <xquery key="xquery/xquery_res.xq">
<variable name="payload" type="ELEMENT"/>
+ <variable name="code" type="STRING"
+
expression="self::node()//m0:return/m0:symbol/child::text()"
+ xmlns:m0="http://services.samples/xsd"/>
+ <variable name="price" type="DOUBLE"
+
expression="self::node()//m0:return/m0:last/child::text()"
+ xmlns:m0="http://services.samples/xsd"/>
</xquery>
- <send/>
+ <send/>
</out>
</outSequence>
</target>
<publishWSDL
uri="file:repository/conf/sample/resources/proxy/sample_proxy_1.wsdl"/>
</proxy>
-
</definitions>
\ No newline at end of file
_______________________________________________
Esb-java-dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/esb-java-dev