-
1. Re: How to return multiple values from cxf webservice?
mahesh_maheshs Aug 14, 2009 1:56 AM (in response to khaliqgaffar)Palette of EIP editor in FID 1.2.1 doesn't have sql component.
If any other component (missing in palette) is to be used, then use he "Generic Endpoint".
Generic endpoint takes the whole URI string as the endpoint property. Add the required jars to class-path for Run/Debug.
If any new component requires bean additions, then define the bean in the Spring Definition xml and add that xml to bean imports section in the EIP.
regards,
mahesh
-
2. Re: How to return multiple values from cxf webservice?
khaliqgaffar Aug 14, 2009 8:23 AM (in response to mahesh_maheshs)Hi Mahesh,
I have already done a sample where i queried the database using sql in FID . My question was how to pass list of records back to webservice call ? Lets say i want to pass list of employee object back to webservice call.
Is there anything which we can do out of the box or please let me know how we can go about doing this.
Regards,
Khaliq
-
3. Re: How to return multiple values from cxf webservice?
mahesh_maheshs Aug 14, 2009 8:50 AM (in response to khaliqgaffar)A CXF component replies the content of OUT. If your SQL component can copy the list of records to the exchange's OUT then it will do (if Exchange's IN or FAULT is set then copy to the exchange's OUT for response).
-
4. Re: How to return multiple values from cxf webservice?
khaliqgaffar Aug 16, 2009 5:32 AM (in response to mahesh_maheshs)Hi Mahesh,
Can you assist me as to how i go about doing this ?
Regards,
Khaliq
-
5. Re: How to return multiple values from cxf webservice?
davsclaus Aug 17, 2009 3:40 AM (in response to khaliqgaffar)cxf -> bean -> sql -> bean2
Where bean2 transforms that result from the SQL to the type the CXF expects which was a List myTransformSqlData(List data) {
...
}
-
6. Re: How to return multiple values from cxf webservice?
khaliqgaffar Aug 17, 2009 6:14 AM (in response to davsclaus)Hi,
I have replicated as suggested by you .Whenever i call the webservice the sql gives the below mentioned exception.
I tried making same sql call via spring jdbc template . I had not issues or exception .
what would be the reason why sql componet is giving this exception . As i read in documentation it also uses spring jdbctemplate.
Regards,
Khaliq
17-Aug-2009 14:06:48 org.apache.cxf.phase.PhaseInterceptorChain doIntercept
WARNING: Interceptor has thrown exception, unwinding now
org.apache.cxf.interceptor.Fault: PreparedStatementCallback; uncategorized SQLException for SQL ; SQL state ; error code ; Invalid column type; nested exception is java.sql.SQLException: Invalid column type
at org.apache.camel.component.cxf.CamelInvoker.invoke(CamelInvoker.java:200)
at org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvokerInterceptor.java:58)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:417)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:269)
at java.util.concurrent.FutureTask.run(FutureTask.java:123)
at org.apache.cxf.workqueue.SynchronousExecutor.execute(SynchronousExecutor.java:37)
at org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(ServiceInvokerInterceptor.java:98)
at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:236)
at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:104)
at org.apache.cxf.transport.http_jetty.JettyHTTPDestination.serviceRequest(JettyHTTPDestination.java:302)
at org.apache.cxf.transport.http_jetty.JettyHTTPDestination.doService(JettyHTTPDestination.java:266)
at org.apache.cxf.transport.http_jetty.JettyHTTPHandler.handle(JettyHTTPHandler.java:70)
at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:765)
at org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:230)
at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
at org.mortbay.jetty.Server.handle(Server.java:326)
at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:534)
at org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:879)
at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:747)
at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:218)
at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)
at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:409)
at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:520)
Caused by: org.springframework.jdbc.UncategorizedSQLException: PreparedStatementCallback; uncategorized SQLException for SQL ; SQL state ; error code ; Invalid column type; nested exception is java.sql.SQLException: Invalid column type
at org.springframework.jdbc.support.SQLStateSQLExceptionTranslator.translate(SQLStateSQLExceptionTranslator.java:124)
at org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.translate(SQLErrorCodeSQLExceptionTranslator.java:322)
at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:604)
at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:616)
at org.apache.camel.component.sql.SqlProducer.process(SqlProducer.java:45)
at org.apache.camel.impl.converter.AsyncProcessorTypeConverter$ProcessorToAsyncProcessorBridge.process(AsyncProcessorTypeConverter.java:43)
at org.apache.camel.processor.SendProcessor.process(SendProcessor.java:84)
at org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:68)
at org.apache.camel.processor.interceptor.StreamCachingInterceptor.proceed(StreamCachingInterceptor.java:87)
at org.apache.camel.processor.interceptor.StreamCachingInterceptor.process(StreamCachingInterceptor.java:82)
at org.apache.camel.processor.DeadLetterChannel.process(DeadLetterChannel.java:189)
at org.apache.camel.processor.DeadLetterChannel.process(DeadLetterChannel.java:133)
at org.apache.camel.processor.Pipeline.process(Pipeline.java:115)
at org.apache.camel.processor.Pipeline.process(Pipeline.java:89)
at org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:68)
at org.apache.camel.processor.interceptor.StreamCachingInterceptor.proceed(StreamCachingInterceptor.java:87)
at org.apache.camel.processor.interceptor.StreamCachingInterceptor.process(StreamCachingInterceptor.java:82)
at org.apache.camel.processor.UnitOfWorkProcessor.process(UnitOfWorkProcessor.java:52)
at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:41)
at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:66)
at org.apache.camel.component.cxf.CamelInvoker.invoke(CamelInvoker.java:185)
... 22 more
Caused by: java.sql.SQLException: Invalid column type
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:146)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:208)
at oracle.jdbc.driver.OraclePreparedStatement.setObjectCritical(OraclePreparedStatement.java:9262)
at oracle.jdbc.driver.OraclePreparedStatement.setObjectInternal(OraclePreparedStatement.java:8843)
at oracle.jdbc.driver.OraclePreparedStatement.setObjectInternal(OraclePreparedStatement.java:9565)
at oracle.jdbc.driver.OraclePreparedStatement.setObject(OraclePreparedStatement.java:9548)
at org.apache.camel.component.sql.SqlProducer$1.doInPreparedStatement(SqlProducer.java:52)
at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:588)
... 40 more
-
7. Re: How to return multiple values from cxf webservice?
davsclaus Aug 17, 2009 6:47 AM (in response to khaliqgaffar)Its Oracle that returns error 17004.
Try google for ORA-17004.
And instead of select * try a SQL that selects the columns you need, such as
select first_name, last_name from employees
Or what the SQL you need to use. You can run it in a SQL tool to ensure that it works and returns what you need. (eg toad, sql+, dbvisualizer etc.)
-
8. Re: How to return multiple values from cxf webservice?
khaliqgaffar Aug 17, 2009 7:23 AM (in response to davsclaus)Currently i am calling this via webservice which is leading this error .If i change to timer component then i have no issues with sql component.
I am attaching webservice flow with sql along with this post.
Regards,
Khaliq
-
CXFDirectSQL-camel.xml 1.4 KB
-
-
9. Re: How to return multiple values from cxf webservice?
khaliqgaffar Aug 18, 2009 1:22 AM (in response to davsclaus)I tried everything checked the sql statement in toad . Wrote a sample spring application which uses spring jdbctemplate to check the sql . Infact i tried the same with timer being start event .
All the above seem to work perfectly . Looks like this is a issues when cxf component when used along with sql component.
Regards,
Khaliq
-
10. Re: How to return multiple values from cxf webservice?
davsclaus Aug 18, 2009 3:37 AM (in response to khaliqgaffar)Hi
Thanks for trying out.
Can you attach or create a sample project that is causing this issue?
And if so attach it to this forum then we can take a look at it.
I have created a ticket about this issue to track it:
-
11. Re: How to return multiple values from cxf webservice?
khaliqgaffar Aug 18, 2009 6:01 AM (in response to davsclaus)Hi ,
I am attaching the entire project for you reference.
Regards,
Khaliq
-
FuseJMSProject.zip 28.6 KB
-
-
12. Re: How to return multiple values from cxf webservice?
njiang Aug 18, 2009 8:29 AM (in response to khaliqgaffar)Can you show me the stack trace for CXF component ?
Here is a thing, you can't put the List directly to the exchange's outMessage body, you need to use a Object array to wrap the list object, or the CamelInvoker will miss-interpret the List object.
Willem
-
13. Re: How to return multiple values from cxf webservice?
njiang Aug 23, 2009 11:39 PM (in response to njiang)Hi Khaliq,
Did you give my suggestion a try ?
Please add some comment on the MR-241, when you have time to try it.
-
14. Re: How to return multiple values from cxf webservice?
indikap Aug 24, 2009 3:26 AM (in response to njiang)Nijang,
If you can give better insight as to what you exactlly want me to do .
Regards,
Khaliq