WSO2 ESB/EI - Pass JSON body from API to DataService - wso2

I'm trying to set up an API in Integrator that targets a DataService. I've gotten the GET routes setup, but not the PUT route.
The API accepts a large JSON string, which I pass into the API via the body of the request. It seems that I couldn't have the DataService directly get the data from the body, it looks like it HAS to be a query parameter. That's annoying, but I can deal with it, so I attempted to send the large JSON string as a query parameter to the DataService.
I couldn't figure out how to send the data as a JSON string. I can send it easily enough as XML, but the DataService is complaining that it's not receiving a string.
So, how do I send this as a JSON string? Even better - is there a way to get the DataService to accept a body payload instead of exclusively query parameters?
I'm also working with Eclipse and json-eval doesn't seem to work, so I've been avoiding it. Hoping that's not part of the problem.
json-eval(.)
Save Failed
com.jayway.jsonpath.JsonPath.compile(Ljava/lang/String;[Lcom/jayway/jsonpath/Predicate;)Lcom/jayway/jsonpath/JsonPath;
My current API resource in Integrator:
<?xml version="1.0" encoding="UTF-8"?>
<sequence name="orders.put.IN" trace="disable" xmlns="http://ws.apache.org/ns/synapse">
<property expression="get-property('query.param.ID')" name="uri.var.id"/>
<property expression="json-eval($.)" name="uri.var.full_data"/>
<property value="1" name="uri.var.last_updated_by"/>
<log level="custom">
<property name="MESSAGE" value="Executing orders.put.IN sequence"/>
<property expression="get-property('uri.var.id')" name="ID"/>
<property expression="get-property('uri.var.full_data')" name="FULL_DATA"/>
<property expression="get-property('uri.var.last_updated_by')" name="LAST_UPDATED_BY"/>
</log>
<property name="messageType" scope="axis2" type="STRING" value="application/json"/>
<property name="Content-Type" scope="transport" type="STRING" value="application/json"/>
<send>
<endpoint name="orders.put.byuserid">
<http method="put" statistics="enable" trace="enable"
uri-template="https://________:8243/services/ORDERS_DataService/{uri.var.id}?LAST_UPDATED_BY={uri.var.last_updated_by}&FULL_DATA={uri.var.full_data}"/>
</endpoint>
</send>
</sequence>
My current DataService:
<data description="____.ORDERS" disableLegacyBoxcarringMode="false" enableBatchRequests="false" enableBoxcarring="false" name="ORDERS_DataService" serviceNamespace="____" serviceStatus="active" transports="http https">
<config enableOData="false" id="default">
<property name="carbon_datasource_name">____</property>
</config>
<query id="update_ORDERS_query" useConfig="default">
<sql>UPDATE ____.ORDERS SET FULL_DATA=?, LAST_UPADTE_DATE=SYSDATE, LAST_UPDATED_BY=? WHERE ID=?</sql>
<param name="FULL_DATA" ordinal="1" sqlType="STRING"/>
<param name="LAST_UPDATED_BY" ordinal="2" sqlType="STRING" />
<param name="ID" ordinal="3" sqlType="STRING"/>
</query>
<resource method="PUT" path="/{ID}">
<call-query href="update_ORDERS_query">
<with-param name="FULL_DATA" query-param="FULL_DATA" />
<with-param name="LAST_UPDATED_BY" query-param="LAST_UPDATED_BY" />
<with-param name="ID" query-param="ID" />
</call-query>
</resource>
</data>
Full error:
java.lang.IllegalArgumentException: Value type miss match, Expected value type - '', but found - 'STRING'
at org.apache.axis2.json.gson.GsonXMLStreamReader.nextValue(GsonXMLStreamReader.java:750)
at org.apache.axis2.json.gson.GsonXMLStreamReader.readValue(GsonXMLStreamReader.java:625)
at org.apache.axis2.json.gson.GsonXMLStreamReader.stateTransition(GsonXMLStreamReader.java:531)
at org.apache.axis2.json.gson.GsonXMLStreamReader.next(GsonXMLStreamReader.java:177)
at org.apache.axiom.om.impl.builder.StAXOMBuilder.parserNext(StAXOMBuilder.java:681)
at org.apache.axiom.om.impl.builder.StAXOMBuilder.next(StAXOMBuilder.java:214)
at org.apache.axiom.om.impl.llom.OMSerializableImpl.build(OMSerializableImpl.java:78)
at org.apache.axiom.om.impl.llom.OMElementImpl.build(OMElementImpl.java:722)
at org.apache.axiom.om.impl.llom.OMElementImpl.detach(OMElementImpl.java:700)
at org.apache.axiom.om.impl.llom.OMNodeImpl.setParent(OMNodeImpl.java:105)
at org.apache.axiom.om.impl.llom.OMElementImpl.addChild(OMElementImpl.java:296)
at org.apache.axiom.om.impl.llom.OMElementImpl.addChild(OMElementImpl.java:212)
at org.apache.axiom.soap.impl.llom.SOAPBodyImpl.addChild(SOAPBodyImpl.java:231)
at org.apache.axis2.json.gson.JSONMessageHandler.invoke(JSONMessageHandler.java:84)
at org.apache.axis2.engine.Phase.invokeHandler(Phase.java:340)
at org.apache.axis2.engine.Phase.invoke(Phase.java:313)
at org.apache.axis2.engine.AxisEngine.invoke(AxisEngine.java:261)
at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:167)
at org.apache.synapse.transport.passthru.ServerWorker.processNonEntityEnclosingRESTHandler(ServerWorker.java:338)
at org.apache.synapse.transport.passthru.ServerWorker.processEntityEnclosingRequest(ServerWorker.java:383)
at org.apache.synapse.transport.passthru.ServerWorker.run(ServerWorker.java:152)
at org.apache.axis2.transport.base.threads.NativeWorkerPool$1.run(NativeWorkerPool.java:172)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)

Found the answer myself. Need to enrich the sequence and clone the body, apparently.
<enrich description="Get Body Payload from original REST request">
<source clone="true" type="body"/>
<target property="payload" type="property"/>
</enrich>
From there it can be used as the property named "payload"
<arg evaluator="xml" expression="get-property('payload')"/>

Related

Is it possible to make your REST API redirect link dynamic/configurable?

I have a REST API on Enterprise Integrator that uses a db lookup mediator to search a microsoft sql server database and redirects based on the whether or not the data exists in the db. I need to make the redirect part of the code configurable/dynamic as it wouldn't make sense to constantly update the url and redeploy every time the url changes.
<api xmlns="http://ws.apache.org/ns/synapse" name="DBLookupAPI" context="/dblookup">
<resource methods="GET" uri-template="/{UserCode}">
<inSequence>
<log level="custom">
<property name="Value" expression="get-property('uri.var.UserCode')"/>
</log>
<dblookup>
<connection>
<pool>
<driver>com.microsoft.sqlserver.jdbc.SQLServerDriver</driver>
<url>jdbc:sqlserver://10.1.1.111\test;databaseName=UserDB</url>
<user>admin</user>
<password>admin</password>
</pool>
</connection>
<statement>
<sql>select UserCode from UserDB.dbo.Users where UserCode =?;</sql>
<parameter expression="get-property('uri.var.UserCode ')" type="CHAR"/>
<result name="foundnr" column="UserCode "/>
</statement>
</dblookup>
<log level="custom">
<property name="Value" expression="get-property('foundnr')"/>
</log>
<filter source="boolean(get-property('foundnr'))" regex="true">
<then>
<log>
<property name="Message" value="Name Exists Lets redirect"/>
</log>
<property name="HTTP_SC" value="302"/>
<property name="Location" value="https://wso2.com/" scope="transport"/>
</then>
<else>
<log>
<property name="Message" value="Name Does Not Exist Lets redirect"/>
</log>
<property name="HTTP_SC" value="302"/>
<property name="Location" value="https://www.youtube.com/" scope="transport"/>
</else>
</filter>
<respond/>
</inSequence>
<outSequence/>
<faultSequence/>
</resource>
</api>
You can use the property mediator as below.
<property name="Location" expression="get-property('registry','REGISTRY_PATH')"/>
Below are the possible options for get-property method.
Read from registry
get-property('registry', String registryPath#propertyName)
get-property('registry', String registryPath)
Read from Java System property
get-property('system', String propertyName)
Read from the environment
get-property('env', String propertyName)
Read from a file
get-property('file', String propertyName)
Read from the context
You can use the class mediator or any other mediator and set the redirect url to the context and use the following property mediator to retrieve it from the context.
<property name="Location" expression="$ctx:ERROR_MESSAGE"/>
Please refer the documentation - https://ei.docs.wso2.com/en/latest/micro-integrator/references/mediators/property-reference/accessing-properties-with-xpath/#get-property-function
There are different ways to do this. One way is to read from environment variables. In the following example the Location property is set from the environment variable named REDIRECT_URL.
<property name="Location" expression="get-property('env','REDIRECT_URL')" scope="transport"/>

How do I call my data service from my REST API and redirect to a URL on Enterprise Integrator?

I have created a data service on Enterprise Integrator that searches a microsoft sql server database for a usercode, if the usercode I am searching for exists in the db the response is the users first name and last name. Is it possible for the user to get redirected to a c# webpage instead of their first name and last name being returned?
I am then calling my data service with my rest api, my intention is to search an microsft sql db and if the data is in the db I should be redirected to a c# webpage. However when I try to test my API I am getting back my json from the Result (Output Mapping) in my query from my data service. I am unsure how to resolve the conflict and any assistance would be greatly appreciated.
My Data Service Code:
`
<data name="restds" transports="http https">
<config enableOData="false" id="restdb">
<property name="carbon_datasource_name">REST</property>
</config>
<query id="query2" useConfig="restdb">
<sql>select UserCode,FirstName,LastName from UserDB.dbo.Users where UserCode=?</sql>
<result outputType="json" useColumnNumbers="true"> {
"users": {
"user": [
 {
 "UserCode": "$1",
 "FirstName": "$2",
 "LastName": "$3"
 }
 ]
 }
} 
 
 </result>
<param name="UserCode" optional="false" sqlType="STRING"/>
</query>
<resource method="GET" path="Users">
<call-query href="query2">
<with-param name="UserCode" query-param="UserCode"/>
</call-query>
</resource>
</data>
My REST API Code:
`<api xmlns="http://ws.apache.org/ns/synapse" name="DSAPI2" context="/dsapi2">
<resource methods="GET" uri-template="/{UserCode}">
<inSequence>
<call>
<endpoint>
<http method="GET" uri-template="http://localhost:8280/services/restds/Users"/>
</endpoint>
</call>
<filter xpath="$body//FirstName/text() != ''">
<then>
<log>
<property name="Message" value="Name Exists Lets redirect"/>
</log>
<property name="HTTP_SC" value="302" scope="axis2" type="STRING"/>
<property name="Location" value="https://wso2.com/" scope="transport" type="STRING"/>
</then>
<else>
<log>
<property name="HTTP_SC" value="302"/>
<property name="Location" value="https://www.youtube.com/"/>
</log>
</else>
</filter>
<respond/>
</inSequence>
<outSequence/>
<faultSequence/>
</resource>
</api>
`
I was expecting to redirect when testing the API, however the response body I am getting is:
{
"users": {}
}
Which is from the json in my data service
You can't do that in the dataservice. In REST API on Integration studio, while you get successful response, you can use HTTP redirect 302. Use property HTTP_SC with 302 code and http header with Location like below:
<property name="HTTP_SC" scope="axis2" type="STRING" value="302"/>
<property name="Location" value="https://developer.mozilla.org/en-US/docs/Web/HTTP/Redirections" scope="transport" type="STRING"/>
You can set the Location address to your c# website.
But I am not sure, if that that solution is not too awkward.
See docs:
Web/HTTP/Redirections and Web/HTTP/Headers/Location
As tmoasz mentioned. You can't do it in the Dataservice, what you can do is interface the Dataservice with an API and handle the redirection logic there. You don't have to use DbLookup or additional mediators to connect to the DB. Simply call your Dataservice from the API. Something like below.
<?xml version="1.0" encoding="UTF-8"?>
<api context="/checkuser" name="YOURAPI" xmlns="http://ws.apache.org/ns/synapse">
<resource methods="GET">
<inSequence>
<call>
<endpoint>
<http method="get" uri-template="http://localhost:8290/rcsrest/Users">
<suspendOnFailure>
<initialDuration>-1</initialDuration>
<progressionFactor>-1</progressionFactor>
<maximumDuration>0</maximumDuration>
</suspendOnFailure>
<markForSuspension>
<retriesBeforeSuspension>0</retriesBeforeSuspension>
</markForSuspension>
</http>
</endpoint>
</call>
<filter xpath="$body//FirstName/text() != ''">
<then>
<log>
<property name="Message" value="Name Exists Lets redirect"/>
</log>
<property name="HTTP_SC" scope="axis2" type="STRING" value="302"/>
<property name="Location" value="https://to-someplace" scope="transport" type="STRING"/>
</then>
<else>
<log>
<property name="Message" value="Name is empty no redirection"/>
</log>
</else>
</filter>
<respond/>
</inSequence>
<outSequence/>
<faultSequence/>
</resource>
</api>
Update
Adding the Query Param to the Payload.
Note: GET request will not allow you to send Payloads in the request body, hence change the Dataservice method to a POST as well.
Dataservice
<data name="restds" transports="http https">
<config enableOData="false" id="restdb">
<property name="carbon_datasource_name">REST</property>
</config>
<query id="query2" useConfig="restdb">
<sql>select UserCode,FirstName,LastName from UserDB.dbo.Users where UserCode=?</sql>
<result outputType="json" useColumnNumbers="true"> {
"users": {
"user": [
 {
 "UserCode": "$1",
 "FirstName": "$2",
 "LastName": "$3"
 }
 ]
 }
} 
 
 </result>
<param name="UserCode" optional="false" sqlType="STRING"/>
</query>
<resource method="POST" path="Users">
<call-query href="query2">
<with-param name="UserCode" query-param="UserCode"/>
</call-query>
</resource>
</data>
API
<api xmlns="http://ws.apache.org/ns/synapse" name="DSAPI2" context="/dsapi2">
<resource methods="GET" uri-template="/{UserCode}">
<inSequence>
<payloadFactory media-type="xml">
<format>
<body xmlns="">
<p:_getusers xmlns:p="ws.wso2.org/dataservice/query2">
<xs:UserCode xmlns:xs="ws.wso2.org/dataservice/query2">$1</xs:UserCode>
</p:_getusers>
</body>
</format>
<args>
<arg evaluator="xml" expression="$url:UserCode"/>
</args>
</payloadFactory>
<call>
<endpoint>
<http method="POST" uri-template="http://localhost:8280/services/restds/Users"/>
</endpoint>
</call>
<filter xpath="$body//FirstName/text() != ''">
<then>
<log>
<property name="Message" value="Name Exists Lets redirect"/>
</log>
<property name="HTTP_SC" value="302" scope="axis2" type="STRING"/>
<property name="Location" value="https://wso2.com/" scope="transport" type="STRING"/>
</then>
<else>
<log>
<property name="HTTP_SC" value="302"/>
<property name="Location" value="https://www.youtube.com/"/>
</log>
</else>
</filter>
<respond/>
</inSequence>
<outSequence/>
<faultSequence/>
</resource>
</api>

How to use property mediator pattern in wso2

When using property mediator pattern i am getting internal server error
<?xml version="1.0" encoding="UTF-8"?>
<sequence xmlns="http://ws.apache.org/ns/synapse" name="regex">
<log level="custom">
<property name="log" value="******************************"/>
</log>
<property name="regex" expression="$url:regex" scope="default"
type="string" pattern="(.|\s)*\S(.|\s)*" group="2"/>
<property name="service_ep"
value="http://www.mocky.io/v2/5d0086223200007700f9d561" />
<header name="To" expression="get-property('service_ep')" />
<log level="full"/>
</sequence>
Response what i am getting :
<am:fault xmlns:am="http://wso2.org/apimanager">
<am:code>0</am:code>
<am:type>Status report</am:type>
<am:message>Runtime Error</am:message>
<am:description>Unknown type : string for the property mediator or the
property value cannot be converted into the specified type.
</am:description>
</am:fault>
The type should be in block letters.
<property name="regex" expression="$url:regex" scope="default"
type="STRING" pattern="(.|\s)*\S(.|\s)*" group="2"/>
Please refer to this documentation. https://docs.wso2.com/display/EI650/Property+Mediator#PropertyMediator-ConfigurationConfigs

Sequence Callout to DS cant parse response

I have a problem to parse the callout response of a dss.
I have 2 servers
WSO2 ESB server (4.9.0)
WSO2 Application Server (5.3.0) with Data Service (4.3.4) feature installed
i make a payload
<payloadFactory description="Payload Processed" media-type="xml">
<format>
<p:archivoProcesado xmlns:p="MyDataService">
<xs:archivo xmlns:xs="MyDataService">$1</xs:archivo>
</p:archivoProcesado>
</format>
<args>
<arg evaluator="xml" expression="get-property('filename')" />
</args>
</payloadFactory>
After that i make a callout
<callout action="archivoProcesado" description="Callout ArchivoProcesado"
initAxis2ClientOptions="false"
serviceURL="http://192.168.0.33:9764/services/MyDataService?wsdl">
<source xmlns:s11="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:s12="http://www.w3.org/2003/05/soap-envelope"
xpath="s11:Body/child::*[fn:position()=1] | s12:Body/child::*[fn:position()=1]" />
<target xmlns:s11="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:s12="http://www.w3.org/2003/05/soap-envelope"
xpath="s11:Body/child::*[fn:position()=1] | s12:Body/child::*[fn:position()=1]" />
</callout>
To test the result i have:
<log level="custom">
<property expression="$body/*" name="RTA" />
</log>
And have:
LogMediator RTA = <ArchivosProcesados xmlns="MyDataService"><ArchivoProcesado><procesado>1</procesado></ArchivoProcesado></ArchivosProcesados>
but when i want to parse the response i cant
<log level="custom">
<property expression="//ArchivosProcesados/ArchivoProcesado/procesado/text()"
name="count" />
</log>
<log level="custom">
<property expression="//ArchivosProcesados" name="xxx" />
</log>
<log level="custom">
<property expression="//ArchivosProcesados/*" name="yyy" />
</log>
and the log is blank
INFO - LogMediator count =
INFO - LogMediator xxx =
INFO - LogMediator yyy =
How can i get the value? what am i doing wrong?
MyDSS
<query id="archivoProcesado" useConfig="MyDataService">
<sql>select count(1) as procesado from auto_procesados where archivo = ?</sql>
<param name="archivo" ordinal="1" paramType="SCALAR" sqlType="STRING" type="IN"/>
<result element="ArchivosProcesados" rowName="ArchivoProcesado">
<element column="procesado" name="procesado"/>
</result>
</query>
<operation name="archivoProcesado">
<call-query href="archivoProcesado">
<with-param name="archivo" query-param="archivo"/>
</call-query>
</operation>
In ESB 4.9.0 we have depricated the callout mediator. So could you please use call mediator [1] with [blocking="true"] instead. If it is not working please enable wirelogs as per [2] and check whether you are getting the response from the DSS endpoint properly. A sample call mediator configuration would be as follows.
<call blocking="true">
<endpoint>
<address format="soap12" uri="http://192.168.0.33:9764/services/MyDataService"/>
</endpoint>
</call>
Also when you get the data from DSS all the data falls under the following name space. http://ws.wso2.org/dataservice. You will have to define a namespace prefix to that namespace and use that in your xpath expressions. An example is given below.
<log level="custom">
<property xmlns:x="http://ws.wso2.org/dataservice" expression="//x:ArchivosProcesados/x:ArchivoProcesado/x:procesado/text()"
name="count" />
</log>
[1] https://docs.wso2.com/display/ESB490/Call+Mediator
[2] http://mytecheye.blogspot.com/2013/09/wso2-esb-all-about-wire-logs.html
Try adding the xmlns attribute to the property mediator.
<log level="custom">
<property xmlns="MyDataService" expression="//ArchivosProcesados/ArchivoProcesado/procesado/text()"
name="count" />
</log>
JP
First of all i change the callout by a blocking call.
After that i change the messageType to json
<property name="messageType" scope="axis2" type="STRING" value="application/json"/>
and then access through json-eval
<property expression="json-eval($.ArchivosProcesados.ArchivoProcesado.procesado)"
name="count" scope="default" type="STRING"/>
Finally i back the message type to xml:
<property name="messageType" scope="axis2" type="STRING" value="text/xml"/>

How to pass dynamic fields Query to database using WSO2ESB OR WSO2DSS

I want to pass my query to database for retrieving the column. I am passing dynamic columns using ESB my configuration is like this
<proxy xmlns="http://ws.apache.org/ns/synapse" name="dbl3" transports="https,http" statistics="disable" trace="disable" startOnLoad="true"> <target>
<inSequence>
<property name="A" value="select e_name,e_address from emp where " scope="default" type="STRING"/>
<property name="B" expression="//fieldname/text()" scope="default" type="STRING"/>
<property name="C" expression="//fieldvalue/text()" scope="default" type="STRING"/>
<property name="D" value="=" scope="default" type="STRING"/>
<property name="E" expression="concat(get-property('A'),get-property('B'),get-property('D'),get-property('C'))" scope="default" type="STRING"/>
<dblookup>
<connection>
<pool>
<password>Youtility11</password>
<user>youtilitydba</user>
<url>jdbc:postgresql://localhost:5432/sample</url>
<driver>org.postgresql.Driver</driver>
</pool>
</connection>
<statement>
<sql>get-property('E')</sql>
<result name="ee" column="e_name"/>
</statement>
</dblookup>
<log level="custom">
<property name="AA" expression="get-property('A')"/>
<property name="BB" expression="get-property('B')"/>
<property name="CC" expression="get-property('C')"/>
<property name="DD" expression="get-property('ee')"/>
<property name="EE" expression="get-property('E')"/>
</log>
</inSequence>
<outSequence>
<send/>
</outSequence> </target> <description></description> </proxy>
My output like this:
EE = select e_name,e_address from emp where e_address=thane
EE = select e_name,e_address from emp where e_no=5
Based on input values query will generate, how can I pass the above query to the database?
My error is like this:
[2013-01-24 14:22:32,743] ERROR - DBLookupMediator Error executing statement : get-property('E') against DataSource : jdbc:postgresql://localhost:5432/sample
org.postgresql.util.PSQLException: ERROR: syntax error at or near "get"
Position: 1
at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2102)
at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1835)
at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:257)
at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:500)
at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:388)
at org.postgresql.jdbc2.AbstractJdbc2Statement.executeQuery(AbstractJdbc2Statement.java:273)
at org.apache.commons.dbcp.DelegatingPreparedStatement.executeQuery(DelegatingPreparedStatement.java:96)
at org.apache.commons.dbcp.DelegatingPreparedStatement.executeQuery(DelegatingPreparedStatement.java:96)
at org.apache.commons.dbcp.DelegatingPreparedStatement.executeQuery(DelegatingPreparedStatement.java:96)
at org.apache.synapse.mediators.db.DBLookupMediator.processStatement(DBLookupMediator.java:46)
at org.apache.synapse.mediators.db.AbstractDBMediator.mediate(AbstractDBMediator.java:143)
at org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:60)
at org.apache.synapse.mediators.base.SequenceMediator.mediate(SequenceMediator.java:114)
at org.apache.synapse.core.axis2.ProxyServiceMessageReceiver.receive(ProxyServiceMessageReceiver.java:154)
at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:181)
at org.apache.axis2.transport.http.util.RESTUtil.invokeAxisEngine(RESTUtil.java:144)
at org.apache.axis2.transport.http.util.RESTUtil.processXMLRequest(RESTUtil.java:89)
at org.apache.synapse.transport.nhttp.util.RESTUtil.processPOSTRequest(RESTUtil.java:189)
at org.apache.synapse.transport.nhttp.ServerWorker.processEntityEnclosingMethod(ServerWorker.java:411)
at org.apache.synapse.transport.nhttp.ServerWorker.run(ServerWorker.java:268)
at org.apache.axis2.transport.base.threads.NativeWorkerPool$1.run(NativeWorkerPool.java:172)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
at java.lang.Thread.run(Thread.java:679)
I'm afraid you can't pass a SQL statement to the "<sql/>" element of the DBLookup/DBReport mediators using "get-property" construct. Besides, I believe what you're trying to do is sort of a hack to pass variables to a SQL query. The proper way of doing this should be by using WSO2 Data Services Server. Please refer the documentation of WSO2 DSS [1] which provides you with a comprehensive guide on how to use it to achieve your data manipulative tasks with its rich set of features offered to the users.
[1] http://docs.wso2.org/wiki/display/DSS301/WSO2+Data+Services+Server+Documentation