-
1. Re: SQL ResultSet as Webservice ?
ffang Aug 22, 2011 9:27 PM (in response to labo32_delaboe)Hi,
This is exactly what RESTful service can do here.
Take a look at cxf-jaxrs example shipped with kit.
Freeman
-
2. Re: SQL ResultSet as Webservice ?
labo32_delaboe Aug 23, 2011 1:22 AM (in response to ffang)Thank you for the information.
Is there the possibility to use the full power of camle routes
within this scenario ?
E.g use sql compoment to perform select statement, use xslt component to prepare response......
Is it possible to use jax-ws instead of REST e.g starting point example cxf-ws-security-osgi ?
Regards
labo
-
3. Re: SQL ResultSet as Webservice ?
ffang Aug 23, 2011 2:49 AM (in response to labo32_delaboe)Hi,
Of course you can use jaxws instead of REST(jaxrs), but your scenario(this kind of CRUD operation) is more suitable of using RESTful service.
If you wanna use camel router, I recommend you to use camel-cxf[1] or camel-cxfrs[2] to handle the request.
http://camel.apache.org/cxf.html
http://camel.apache.org/cxfrs.html
Freeman
-
4. Re: SQL ResultSet as Webservice ?
labo32_delaboe Aug 23, 2011 3:43 PM (in response to ffang)Hello,
I started with the example http://camel.apache.org/cxfrs.html
I adapted the cxf-jaxrs example since it has already the required beans.
My Bundle is active but when I type the URL into the browser
http://localhost:9000/route/customerservice/customers/123
I got an exception in the log file
Interceptor for WebClient has thrown exception, unwinding now org.apache.cxf.interceptor.Fault: Could not send Message.
Ok, if I am right we have different ports/urls for the request and the response and my browser cannot handle it but I don't know how to write a client for that.
Is there a complete example for http://camel.apache.org/cxfrs.html available in svn ?
The next steps to reach my goal are also not clear for me.
I'd like to do:
Thanks
labo
-
5. Re: SQL ResultSet as Webservice ?
labo32_delaboe Aug 24, 2011 2:12 AM (in response to labo32_delaboe)I solved the first part..... I had a typo in my beans.xml
Communication works with url
http://localhost:9000/route/customerservice/customers/123
Can you explain me the communication between jaxrs:server,cxf:rsServer and cxf:rsClient ?
Do I have to add two Service beans for cxf:rsServer and cxf:rsClient ?
The first on which picks up the id from cxf:rsServer , provide it to an sql step, a bean which processes the result and add a customer object to the payload and provide this to the cxf:rsClient ?
-
6. Re: SQL ResultSet as Webservice ?
labo32_delaboe Aug 25, 2011 2:55 PM (in response to ffang)I need some further help !!
My bundle starts, the sql is executed succesful (I can see the output in the log) but my response is not as expected.
I am still not sure how to setup the beans for jaxrs:server,cxf:rsServer and cxf:rsClient....
it seems that only the bean from cxf:rsClient takes affect....
Can somebody give me a hint ?
Thanks
labo
-
7. Re: SQL ResultSet as Webservice ?
labo32_delaboe Aug 26, 2011 3:02 AM (in response to ffang)Sorry..... me again.
Since I want to use the power of camel within my route based on http://camel.apache.org/cxfrs.html I need help, otherwise I have to impelment my requirements by myself (adapt the CustomerService Bean to perform sql , sql processing and return) and I don't think that this is the right way.
I need a way to change the Customer bean in my camel route..... but I do not have any idea (or better all my ideas caused an errror or the return is still the object created in the init method of CustomerService bean)
-
8. Re: SQL ResultSet as Webservice ?
davsclaus Aug 27, 2011 2:37 AM (in response to labo32_delaboe)Hi
If you have a route like this:
<route> <from uri="cxfrs://bean://rsServer"></from> ..... send the provided id to payload ..... perform sql with the id ..... create Customer Object from result set and send back to client <to uri="cxfrs://bean://rsClient"></to> </route>
Then you do not need that last step, to send back the reply to the client. Instead when the route ends, then the consumer (eg in the ) will send back the reply to the client.
So instead do something like
<from uri="cxfrs://bean://rsServer"/> ..... send the provided id to payload ..... perform sql with the id ..... create Customer Object from result set
-
9. Re: SQL ResultSet as Webservice ?
labo32_delaboe Aug 29, 2011 3:33 PM (in response to davsclaus)This hint solved my problem. (try to mark it as helpful and correct but only the first choice has been accepted)
Thanks a lot
labo