<component id="myServiceUsingXMLText"
service="my:groovyXSQLBuilder"
class="org.servicemix.components.groovy.GroovyComponent" destinationService="my:trace" destinationService="my:xsqlService">
<property name="scriptText">
<value>
<![CDATA[
outMessage.bodyText = """
<xsql:query connection="demo" bind-params="City" xmlns:xsql="urn:oracle-xsql">
SELECT Carrier, FlightNumber, Origin, TO_CHAR(ExpectedTime,'HH24:MI') Due
FROM FlightSchedule
WHERE TRUNC(ArrivalTime) = TRUNC(SYSDATE)
AND Destination = *${inMessage.properties.destinationName}*
ORDER BY ExpectedTime
</xsql:query>
"""
]]>
</value>
</property>
</component>
As long as destinationName is bound to the inMessage, you should good. Don't set the XSQL url in the XSQL component, and it will take the XML message genrated by this component as the document. Mind you, I have not tested it as I do not have a DB to go against at the moment, but the XML is created correctly (I think).
Hope it helps.
Birch
On 10/27/05, J B <[EMAIL PROTECTED]> wrote:
Looking at the source, it does not appear to allow variable substitution. Seems like it wouldn't be that hard to support. But as for a working solution right now, you could have a component generate the XSQL document on the fly with parameters passed in to it, then forward that document to the XSQL component. If you do not set the XSQL document in the configuration of the XSQL component, then it will attempt to create one out of the message passed to it. A groovy component could easily use the xmlbuilder to generate the document
Hope that helps.
BirchOn 10/27/05, Angel Gomez < [EMAIL PROTECTED] > wrote:
Hello.
Is it possible to pass parameters in the call to a XSQL component
like in the Oracle documentation, with the xsql page specified in the
configuration file?
<?xml version="1.0 "?>
<xsql:query connection="demo" *bind-params="City"* xmlns:xsql="urn:oracle-xsql">
SELECT Carrier, FlightNumber, Origin, TO_CHAR(ExpectedTime,'HH24:MI') Due
FROM FlightSchedule
WHERE TRUNC(ArrivalTime) = TRUNC(SYSDATE)
AND Destination = *?*
ORDER BY ExpectedTime
</xsql:query>
Regards.
