Setting table as input parameter

jr97's picture
I'm trying to create a web service with WSAS 3.1.1 and it's just a simple query but I want to have the table be the input paramater. (e.g. SELECT * FROM ?) The problem is that I think the SQL Type STRING puts the parameter in quotes resulting in an incorrect query format. Is there a workaround? Thanks.
jr97's picture

Solution was to create a

Solution was to create a stored procedure.
jr97's picture

Upgrading 3.1.2 busted my

Upgrading 3.1.2 busted my webservice. This service works great in 3.1.1 but not in 3.1.2.

The query string:

 


<query id="GetSchools" useConfig="T2">
        <sql>call getschools(?,?,?)</sql>
        <result element="ClientGroup" rowName="School" defaultNamespace="">
            <element name="custnum" column="custnum"/>
            <element name="sch_name" column="sch_name"/>
            <element name="sch_address" column="sch_address"/>
            <element name="sch_city" column="sch_city"/>
            <element name="sch_st" column="sch_st"/>
            <element name="sch_zip" column="sch_zip"/>
            <element name="sch_address_full" column="sch_address_full"/>
        </result>
        <param name="tableName" sqlType="STRING" type="" ordinal="0"/>
        <param name="divider" sqlType="STRING" type="" ordinal="0"/>
        <param name="citystatedivider" sqlType="STRING" type="" ordinal="0"/>
    </query>

 


The error:

Fault: DS Fault Message: Error in 'SQLQuery.processStoredProcQuery' Source Data Service:- Name: T2Control Location: C:\wso2\WSAS-3~1.2\bin\..\repository\dataservices\T2Control.dbs Description: N/A Default Namespace: http://ws.wso2.org/dataservice Current Request Name: GetSchools Current Params: {citystatedivider=|, tableName=ea_school, divider=|} Nested Exception:- com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'NULL' at line 1 at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27) at java.lang.reflect.Constructor.newInstance(Constructor.java:513) at com.mysql.jdbc.Util.handleNewInstance(Util.java:406) at com.mysql.jdbc.Util.getInstance(Util.java:381) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1030) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:956) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3536) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3468) at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1957) at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2107) at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2648) at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:2086) at com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:2237) at com.mysql.jdbc.CallableStatement.executeQuery(CallableStatement.java:912) at org.apache.commons.dbcp.DelegatingPreparedStatement.executeQuery(DelegatingPreparedStatement.java:93) at org.wso2.carbon.dataservices.dispatch.query.SQLQuery.processStoredProcQuery(SQLQuery.java:362) at org.wso2.carbon.dataservices.dispatch.query.SQLQuery.runQuery(SQLQuery.java:1088) at org.wso2.carbon.dataservices.dispatch.query.Query.execute(Query.java:110) at org.wso2.carbon.dataservices.dispatch.CallQuery.execute(CallQuery.java:72) at org.wso2.carbon.dataservices.dispatch.operation.Operation.execute(Operation.java:50) at org.wso2.carbon.dataservices.dispatch.DataService.invoke(DataService.java:186) at org.wso2.carbon.dataservices.dispatch.DSOMDataSource.serialize(DSOMDataSource.java:87) at org.apache.axiom.om.impl.llom.OMSourcedElementImpl.internalSerializeAndConsume(OMSourcedElementImpl.java:738) at org.apache.axiom.om.impl.llom.OMElementImpl.internalSerialize(OMElementImpl.java:966) at org.apache.axiom.om.impl.llom.OMElementImpl.internalSerializeAndConsume(OMElementImpl.java:995) at org.apache.axiom.soap.impl.llom.SOAPEnvelopeImpl.serializeInternally(SOAPEnvelopeImpl.java:254) at org.apache.axiom.soap.impl.llom.SOAPEnvelopeImpl.internalSerialize(SOAPEnvelopeImpl.java:242) at org.apache.axiom.om.impl.llom.OMElementImpl.internalSerializeAndConsume(OMElementImpl.java:995) at org.apache.axiom.om.impl.llom.OMNodeImpl.serializeAndConsume(OMNodeImpl.java:486) at org.apache.axis2.transport.http.SOAPMessageFormatter.writeTo(SOAPMessageFormatter.java:79) at org.apache.axis2.transport.http.CommonsHTTPTransportSender.sendUsingOutputStream(CommonsHTTPTransportSender.java:355) at org.apache.axis2.transport.http.CommonsHTTPTransportSender.invoke(CommonsHTTPTransportSender.java:232) at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:440) at org.apache.axis2.receivers.AbstractInOutSyncMessageReceiver.invokeBusinessLogic(AbstractInOutSyncMessageReceiver.java:45) at org.apache.axis2.receivers.AbstractMessageReceiver.receive(AbstractMessageReceiver.java:114) at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:178) at org.apache.axis2.transport.http.HTTPTransportUtils.processHTTPPostRequest(HTTPTransportUtils.java:167) at org.apache.axis2.transport.http.AxisServlet.doPost(AxisServlet.java:142) at javax.servlet.http.HttpServlet.service(HttpServlet.java:709) at javax.servlet.http.HttpServlet.service(HttpServlet.java:802) at org.eclipse.equinox.http.servlet.internal.ServletRegistration.handleRequest(ServletRegistration.java:90) at org.eclipse.equinox.http.servlet.internal.ProxyServlet.processAlias(ProxyServlet.java:111) at org.eclipse.equinox.http.servlet.internal.ProxyServlet.service(ProxyServlet.java:67) at javax.servlet.http.HttpServlet.service(HttpServlet.java:802) at org.wso2.carbon.bridge.BridgeServlet.service(BridgeServlet.java:135) at javax.servlet.http.HttpServlet.service(HttpServlet.java:802) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:210) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:174) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:151) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:870) at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665) at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528) at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81) at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:685) at java.lang.Thread.run(Thread.java:619)

 

library project main code
Learn Cloud
Learn
Cloud

The WSO2 Application Server is a reliable application server that can host your enterprise web applications. The WSO2 Application Server as a Service is offered in StratosLive, the WSO2 Platform as a Service. This article explains how a simple web application can be developed and deployed from Carbon Studio to the WSO2 Application Server...

Latest Webinar
Different groups within an organization need to monitor different Key Performance Indicators (KPIs) - An operations team will be interested in the response times of business services and loads of each service,..
Thursday, February 9th 2012, 09.00 AM (PST)

Thursday, February 9th 2012, 10.00 AM (GMT)