-
1. Re: Expose an endpoint as web service
ffang Apr 14, 2011 9:09 PM (in response to manta7)Hi,
You can use
1. servicemix-cxf-bc consumer, the flow is like
cxfbc:consumer-->jms provider
cxfbc:consumer can expose a SOAP webservice
or
2. use camel-cxf, something like
from(cxf://...).to(jms://)
camel-cxf can also expose a SOAP webservice
in both case you need provide a wsdl, which can specify what your soap message should be.
Freeman
-
2. Re: Expose an endpoint as web service
manta7 Apr 21, 2011 7:46 AM (in response to ffang)Or easier, to expose a bean as a webservice can I use camel-cxf ?
But the WSDL can't be generated by Servicemix ?
-
3. Re: Expose an endpoint as web service
manta7 Apr 22, 2011 3:47 AM (in response to manta7)Ok I followed the cxf-wsdl-first-osgi-package example ( http://repo1.maven.org/maven2/org/apache/servicemix/examples/cxf-wsdl-first-osgi-package/)
It works well, I can send SOAP requests to my bundle.
But my idea is to get the message sent by a SOAP client with camel.
So I made an interceptor:
from("cxf://http://localhost:8093/PersonService/?wsdlURL=classpath:person.wsdl&serviceName=http://servicemix.apache.org/samples/wsdl-first}PersonService&serviceClass=org.apache.servicemix.samples.wsdl_first.Person").
to("log:Test");
But it doesn't work ? Nothing happend into the log when I send a SOAP request...
Did I forget something ??
-
4. Re: Expose an endpoint as web service
manta7 Apr 22, 2011 4:24 AM (in response to manta7)Or the reverse way, from my PersonImpl, send the message request to a ActiveMQ queue
-
5. Re: Expose an endpoint as web service
davsclaus Apr 22, 2011 5:25 AM (in response to manta7)There are some webinars which covers how to do web serivces. It might be worthwhile to checkout
-
6. Re: Expose an endpoint as web service
manta7 Apr 22, 2011 5:30 AM (in response to davsclaus)I succeed to make a web service
I'm just trying to link a web service implementation with a JMS queue
-
7. Re: Expose an endpoint as web service
davsclaus Apr 22, 2011 5:36 AM (in response to manta7)There is also this fairly simple CXF examples at Apache
http://camel.apache.org/cxf-tomcat-example.html
http://camel.apache.org/cxf-proxy-example.html
And a new example about OSGi when using HTTP service (requires Camel 2.8)
http://camel.apache.org/cxf-example-osgi.html
They expose a web service using Camel in a route. Then you can route that to eg a JMS queue instead.
-
8. Re: Expose an endpoint as web service
manta7 Apr 22, 2011 8:45 AM (in response to davsclaus)Thanks a lot for the links it was very helpful
But I still have a last problem:
In my PersonImpl (which is called when a SOAP request is sent), I'd like to access to a Camel endpoint with:
JndiContext context = new JndiContext();
CamelContext camelContext = new DefaultCamelContext(context);
camelContext.start();
org.apache.camel.Endpoint endpoint = camelContext.getEndpoint("activemq:queue/myQueue");
camelContext.stop();
But I get a: Exception:org.apache.camel.RuntimeCamelException: org.apache.camel.TypeConverterLoaderException: Failed to load type converters because of: Cannot find any type converter classes from the following packages: org.apache.camel.component.file, org.apache.camel.component.bean, org.apache.camel.converter
How surprising
Edited by: manta7 on Apr 22, 2011 12:43 PM
-
9. Re: Expose an endpoint as web service
ffang Apr 22, 2011 10:01 AM (in response to manta7)Hi,
I'm not sure it's a good idea to explicitly init camel context in PersonImpl which is from cxf se endpoint, ideally you should use pure camel DSL to manage your router.
This exception generally means you didn't install necessary camel feature(camel-activemq for your case) or your cxf se bundle didn't import necessary camel component package.
Freeman
-
10. Re: Expose an endpoint as web service
manta7 Apr 22, 2011 10:03 AM (in response to ffang)Ok I see...
But if I don't init my camel context in the PersonImpl, how can I reach an camel endpoint from PersonImpl ?
-
11. Re: Expose an endpoint as web service
manta7 Apr 22, 2011 10:23 AM (in response to ffang)And it's weird cause I have the activemq-camel dependency in my pom.xml, and I just have a central bundle which contains also the cxfse xml configuration
I just see that it's the camelContext.start() which failed
Edited by: manta7 on Apr 22, 2011 2:22 PM
-
12. Re: Expose an endpoint as web service
ffang Apr 22, 2011 9:29 PM (in response to manta7)Hi,
I think your working flow is wrong here. Do you really need a cxf se endpoint?
cxf se endpoint basically just process the business logic inside ESB.
The easiest way for you is use camel-cxf endpoint to receive external client request and then in camel router you can use camel-activemq endpoint to send to a queue.
So all router should be in from().to() style.
Freeman
-
13. Re: Expose an endpoint as web service
ffang Apr 22, 2011 9:30 PM (in response to manta7)Hi,
Have activemq-camel dependency in your pom.xml doesn't mean the activemq-camel feature bundles already installed in the OSGi container.
You need do
features:install activemq-camel
beforehand.
Freeman
-
14. Re: Expose an endpoint as web service
manta7 Apr 26, 2011 5:01 AM (in response to ffang)Sorry for all the questions but I'm a little bit lost.. (and thanks for the answers!)
This is my configuration:
<cxfbc:consumer wsdl="classpath:person.wsdl" endpoint="soap" targetService="person:PersonService" targetInterface="person:Person">
</cxfbc:consumer>
<cxfse:endpoint endpoint="soap">
<cxfse:pojo>
<bean class="org.apache.servicemix.samples.wsdl_first.PersonImpl" />
</cxfse:pojo>
</cxfse:endpoint>
I didn't find how I could route the client-soap-request with camel..
from("???").
to("log:hellox");
I tried with cxf:bean:hello and others but it don't works