Re: How to expose a CXF WebService as an Endpoint with DSL ?

2009-01-23 Thread Claus Ibsen
Hi

Maybe part 5 of this tutorial can help you a bit
http://camel.apache.org/tutorial-example-reportincident.html

Its exposing a POJO webservice in pure Java


On Fri, Jan 23, 2009 at 12:43 PM, Guillaume Renault
guillaume.rena...@bull.net wrote:
 Hi list,

 Thx for the answer Willem. However, i did read the wiki page before, and
 analysed the example, but finally didn't really found what i was looking
 for. Here are some questions that i'm still asking  :-)  :

 (BTW, i'm using java to configure Camel, and not spring)

 In the example of CXF, you're using two ways to declare the service. One way
 is to declare a jxws endpoint. the second way is to use the Busfactory,
 given an xml configuration file. As i'm not using Spring, i guess that the
 right way is to use the jaxws endpoint ? however, if so, we need annotations
 on the serviceClass ... How to expose a simple POJO then ?
 Is the cxf component configured by default in Camel ? i mean, if i get the
 component cxf from the context, will it return a CxfComponent or null ? and
 if i get it, i can create an Endpoint with the right properties, just
 setting the serviceClass and the URI ... ?
 When Camel deploys a webservice just knowing the class that contains the
 service, what's the address of the webservice ? which context does it
 provides (in the case of a POJO, otherwise annotations are here to set this
 ...)?
 Do you have an example of a POJO exposed as a WS somewhere, in JAVA ?

 Don't hesitate to correct me if i did understand something in a wrong way.
 As soon as it'll be clear for me, i'll try to provide a very simple example
 and some doc :)

 The other things work fine, and it's really easy to set some route.

 Regards,

 Guillaume

 Hi,
 Please see my comments in the mail.
 Guillaume Renault wrote:


  Hi Camel users,
 
  I'm a new user, and you may hear from me sometime   ;)
  i'm trying to use CXF as an access point on Camel. some questions are
  crossing my mind:
 
 1. Is it possible to just have annotated classes (Interface +
implementation) and let Camel exposes it as a webservice, without
any more information ? is it even possible to give Camel a simple
POJO without any annotation ?


  Yes, Current camel-cxf component can support both annotated classes and
 POJO without any annotation.
 camel-cxf will check the SEI (Service Endpoint Interface), if it has the
 @WebService annotation, camel-cxf will use the JAXWS frontend API to
 publish the service or create a proxy of the web services, if it hasn't
 any annotation camel-cxf will use simple front end API to those things.


 2. If yes, what is the right procedure ? I'm not using spring, and
i'm working in an OSGi environment, as i'm integrating Camel into
JOnAS 5.1.X.


 Please take go through the camel-cxf wiki page[1][2] first.


 
Do i need to first declare a CxfComponent, and then create an
Endpoint, and give it the service class ?


 No, you just need to use a URI to specify the CXF endpoint, the Spring
 configuration is not required.


Do i need to just use the following :
 
Object implementor = new SayHello();
String address = http://cxf.apache.org/transports/jms;;
Endpoint endpoint = Endpoint.publish(address, implementor);
 
Or maybe something else ...
 
?


 No, you don't need to create the endpoint yourself. camel-cxf component
 will take care of that.
 You can find more information in the cxf exmaple[2].


 
  Btw, i'll have to talk with you about Camel on OSGi, i did have to do
  some extends to make it correctly works   ;)  , but it will come latter.


 Please shot if you find anything wrong   :)


 
  Regards,
 
  Guillaume
 
  --
  Guillaume Renault - BULL Service
  BULL - Architect of an Open World
  Email : guillaume.rena...@bull.net
  Tel : +334 76 29 71 09
  Office : B1-295
  Web : http://jasmine.ow2.org
  (\ _ /)
  (='.'=)
  ()-()
 


 [1]http://camel.apache.org/cxf.html
 [2]http://camel.apache.org/cxf-example.html

 Willem


 --
 Guillaume Renault - BULL Service
 BULL - Architect of an Open World
 Email : guillaume.rena...@bull.net
 Tel : +334 76 29 71 09
 Office : B1-295
 Web : http://jasmine.ow2.org
 web : http://jonas.ow2.org
 (\ _ /)
 (='.'=)
 ()-()




-- 
Claus Ibsen
Apache Camel Committer

Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/


Re: Definining interceptors in camel-cxf

2009-01-23 Thread William Tam
The stack does not match the current source.   (It points to the old
CxfProducer before refactoring.)   Could you compile manually and
re-test it?

Any idea why the 2.0 snapshot is more than a week old, anyone?


On Fri, Jan 23, 2009 at 10:44 AM, S. Ali Tokmen
savas-ali.tok...@bull.net wrote:
 Hello

 Unfortunately, Camel 2.0-SNAPSHOT and CXF 2.2-SNAPSHOT (versions present on
 the 23/01/2009) seem to break. I have an exception:

   java.lang.NullPointerException
  at

 org.apache.camel.component.cxf.CxfProducer.createClientFromClientFactoryBean(CxfProducer.java:97)
  at
   org.apache.camel.component.cxf.CxfProducer.init(CxfProducer.java:70)
  at

 org.apache.camel.component.cxf.CxfEndpoint.createProducer(CxfEndpoint.java:74)
  at
   org.apache.camel.processor.SendProcessor.doStart(SendProcessor.java:92)
  at
   org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:49)
  at
   org.apache.camel.util.ServiceHelper.startServices(ServiceHelper.java:64)
  at

 org.apache.camel.processor.MulticastProcessor.doStart(MulticastProcessor.java:253)
  at
   org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:49)
  at
   org.apache.camel.util.ServiceHelper.startServices(ServiceHelper.java:64)
  at
   org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:47)
  at
   org.apache.camel.util.ServiceHelper.startServices(ServiceHelper.java:64)
  at

 org.apache.camel.processor.MulticastProcessor.doStart(MulticastProcessor.java:253)
  at
   org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:49)
  at
   org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:42)
  at
   org.apache.camel.util.ServiceHelper.startServices(ServiceHelper.java:53)
  at

 org.apache.camel.processor.DelegateProcessor.doStart(DelegateProcessor.java:68)
  at
   org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:49)
  at
   org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:42)
  at
   org.apache.camel.util.ServiceHelper.startServices(ServiceHelper.java:53)
  at

 org.apache.camel.processor.DelegateAsyncProcessor.doStart(DelegateAsyncProcessor.java:54)
  at
   org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:49)
  at
   org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:42)
  at
   org.apache.camel.util.ServiceHelper.startServices(ServiceHelper.java:53)
  at
   org.apache.camel.impl.DefaultConsumer.doStart(DefaultConsumer.java:85)
  at
   org.apache.camel.component.jms.JmsConsumer.doStart(JmsConsumer.java)
  at
   org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:49)
  at

 org.apache.camel.impl.DefaultCamelContext.addService(DefaultCamelContext.java:421)
  at

 org.apache.camel.impl.DefaultCamelContext.startRoutes(DefaultCamelContext.java:683)
  at

 org.apache.camel.impl.DefaultCamelContext.doStart(DefaultCamelContext.java:652)
  at

 org.apache.camel.spring.SpringCamelContext.maybeDoStart(SpringCamelContext.java:166)
  at

 org.apache.camel.spring.SpringCamelContext.doStart(SpringCamelContext.java:161)
  at
   org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:49)
  at

 org.apache.camel.spring.SpringCamelContext.maybeStart(SpringCamelContext.java:96)
  at

 org.apache.camel.spring.SpringCamelContext.onApplicationEvent(SpringCamelContext.java:115)
  at

 org.springframework.context.event.SimpleApplicationEventMulticaster$1.run(SimpleApplicationEventMulticaster.java:78)
  at

 org.springframework.core.task.SyncTaskExecutor.execute(SyncTaskExecutor.java:49)
  at

 org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:76)
  at

 org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:274)
  at

 org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:736)
  at

 org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:383)
  at

 org.springframework.context.support.ClassPathXmlApplicationContext.init(ClassPathXmlApplicationContext.java:139)
  at

 org.springframework.context.support.ClassPathXmlApplicationContext.init(ClassPathXmlApplicationContext.java:93)
  at

 org.apache.camel.spring.Main.createDefaultApplicationContext(Main.java:232)
  at org.apache.camel.spring.Main.doStart(Main.java:186)
  at
   org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:49)
  at

 org.ow2.jonas.camel.server.CamelWrapper$CamelThread.run(CamelWrapper.java:101)
  ... 1 more

 There's also a regression in Camel: the org.apache.camel.Component and
 

Proper way to escape invalid XML characters

2009-01-23 Thread Tom T.

I'm using Camel 1.2 and won't be able to upgrade for various reasons.  We are
encountering some Vertical Tabs (0xb) characters and would like to strip
them when Marshaling the message.

I am setting a JaxbDataFormat as the marshaller.  And I see it instantiates
a com.sun.xml.bind.v2.runtime.MarshallerImpl

But I'm not sure how to go about stripping out these invalid XML characters.

Any advice?
-- 
View this message in context: 
http://www.nabble.com/Proper-way-to-escape-invalid-XML-characters-tp21633526s22882p21633526.html
Sent from the Camel - Users mailing list archive at Nabble.com.



Re: Definining interceptors in camel-cxf

2009-01-23 Thread Willem Jiang
I think it may relate to the change of camel's repository.
We need to update the deploy script :(.

Before that ,  check out the code and build it locally is a option.

Willem

William Tam wrote:
 The stack does not match the current source.   (It points to the old
 CxfProducer before refactoring.)   Could you compile manually and
 re-test it?
 
 Any idea why the 2.0 snapshot is more than a week old, anyone?
 
 
 On Fri, Jan 23, 2009 at 10:44 AM, S. Ali Tokmen
 savas-ali.tok...@bull.net wrote:
 Hello

 Unfortunately, Camel 2.0-SNAPSHOT and CXF 2.2-SNAPSHOT (versions present on
 the 23/01/2009) seem to break. I have an exception:

   java.lang.NullPointerException
  at

 org.apache.camel.component.cxf.CxfProducer.createClientFromClientFactoryBean(CxfProducer.java:97)
  at
   org.apache.camel.component.cxf.CxfProducer.init(CxfProducer.java:70)
  at

 org.apache.camel.component.cxf.CxfEndpoint.createProducer(CxfEndpoint.java:74)
  at
   org.apache.camel.processor.SendProcessor.doStart(SendProcessor.java:92)
  at
   org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:49)
  at
   org.apache.camel.util.ServiceHelper.startServices(ServiceHelper.java:64)
  at

 org.apache.camel.processor.MulticastProcessor.doStart(MulticastProcessor.java:253)
  at
   org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:49)
  at
   org.apache.camel.util.ServiceHelper.startServices(ServiceHelper.java:64)
  at
   org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:47)
  at
   org.apache.camel.util.ServiceHelper.startServices(ServiceHelper.java:64)
  at

 org.apache.camel.processor.MulticastProcessor.doStart(MulticastProcessor.java:253)
  at
   org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:49)
  at
   org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:42)
  at
   org.apache.camel.util.ServiceHelper.startServices(ServiceHelper.java:53)
  at

 org.apache.camel.processor.DelegateProcessor.doStart(DelegateProcessor.java:68)
  at
   org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:49)
  at
   org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:42)
  at
   org.apache.camel.util.ServiceHelper.startServices(ServiceHelper.java:53)
  at

 org.apache.camel.processor.DelegateAsyncProcessor.doStart(DelegateAsyncProcessor.java:54)
  at
   org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:49)
  at
   org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:42)
  at
   org.apache.camel.util.ServiceHelper.startServices(ServiceHelper.java:53)
  at
   org.apache.camel.impl.DefaultConsumer.doStart(DefaultConsumer.java:85)
  at
   org.apache.camel.component.jms.JmsConsumer.doStart(JmsConsumer.java)
  at
   org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:49)
  at

 org.apache.camel.impl.DefaultCamelContext.addService(DefaultCamelContext.java:421)
  at

 org.apache.camel.impl.DefaultCamelContext.startRoutes(DefaultCamelContext.java:683)
  at

 org.apache.camel.impl.DefaultCamelContext.doStart(DefaultCamelContext.java:652)
  at

 org.apache.camel.spring.SpringCamelContext.maybeDoStart(SpringCamelContext.java:166)
  at

 org.apache.camel.spring.SpringCamelContext.doStart(SpringCamelContext.java:161)
  at
   org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:49)
  at

 org.apache.camel.spring.SpringCamelContext.maybeStart(SpringCamelContext.java:96)
  at

 org.apache.camel.spring.SpringCamelContext.onApplicationEvent(SpringCamelContext.java:115)
  at

 org.springframework.context.event.SimpleApplicationEventMulticaster$1.run(SimpleApplicationEventMulticaster.java:78)
  at

 org.springframework.core.task.SyncTaskExecutor.execute(SyncTaskExecutor.java:49)
  at

 org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:76)
  at

 org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:274)
  at

 org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:736)
  at

 org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:383)
  at

 org.springframework.context.support.ClassPathXmlApplicationContext.init(ClassPathXmlApplicationContext.java:139)
  at

 org.springframework.context.support.ClassPathXmlApplicationContext.init(ClassPathXmlApplicationContext.java:93)
  at

 org.apache.camel.spring.Main.createDefaultApplicationContext(Main.java:232)
  at org.apache.camel.spring.Main.doStart(Main.java:186)
  at
   

Re: cxf spring configuration (camel 1.5.0)

2009-01-23 Thread Willem Jiang
I just created a JIRA[1] for it, it should be fixed in the coming up
CAMEL 1.6.

[1]https://issues.apache.org/activemq/browse/CAMEL-1294

Willem

Willem Jiang wrote:
 Hi,
 
 Current cxfEndpoint can't be directly used as a camel Endpoint.
 You need to change your camel context
 
  camel:camelContext
  xmlns=http://activemq.apache.org/camel/schema/spring; id=camel
  useJmx=false
 
  route
  from uri=cxf:bean:serviceEndpoint/
  to id=aq1_In uri=file:c:\temp\in/
  /route
/camel:camelContext
 
 Willem
 
 
 pevgen wrote:
 Hello.

 I try to configurate a cxf-endpoint in a spring config. But i got error 
 org.springframework.beans.factory.BeanNotOfRequiredTypeException: Bean
 named 'serviceEndpoint' must be of type [org.apache.camel.Endpoint], but was
 actually of type [org.apache.camel.component.cxf.spring.CxfEndpointBean]

 config.xml :

 ?xml version=1.0 encoding=UTF-8?
 beans xmlns=http://www.springframework.org/schema/beans;
xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance;
xmlns:jaxws=http://cxf.apache.org/jaxws;
xmlns:cxf=http://activemq.apache.org/camel/schema/cxfEndpoint;
 
xmlns:camel=http://activemq.apache.org/camel/schema/spring;
xsi:schemaLocation=http://www.springframework.org/schema/beans
 http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
http://activemq.apache.org/camel/schema/spring
 http://activemq.apache.org/camel/schema/spring/camel-spring.xsd
http://activemq.apache.org/camel/schema/cxfEndpoint
 http://activemq.apache.org/camel/schema/cxf/cxfEndpoint.xsd
http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd;

 import resource=classpath:META-INF/cxf/cxf.xml/
 import resource=classpath:META-INF/cxf/cxf-extension-soap.xml/
 import resource=classpath:META-INF/cxf/cxf-servlet.xml/

 cxf:cxfEndpoint name=serviceEndpoint id=serviceEndpoint
 address=/incident
 serviceClass=ru.transsys.testcxf.TestEndpointImpl/
 !--endpointName=s:TestEndpointPort--
 !--serviceName=s:TestEndpointService--
 !--xmlns:s=http://test.transsys.ru; /--
 

 camel:camelContext
 xmlns=http://activemq.apache.org/camel/schema/spring; id=camel
 useJmx=false

 route
 from ref=serviceEndpoint/
 to id=aq1_In uri=file:c:\temp\in/
 /route
 /camel:camelContext

 !-- implementation of the webservice --
 bean id=testEndpoint class=ru.transsys.testcxf.TestEndpointImpl/

 /beans

 what do you think about it ?

 thanks,
 Evgeny