camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chris Richmond <crichm...@referentia.com>
Subject Re: CXF Webservice in Camel
Date Wed, 11 May 2011 06:09:00 GMT
I should add that at first I did not generate artifacts from the wsdl, 
as when I was running in a pure CXF server application my interface and 
implementation class for my web service I allowed to generate my WSDL 
automatically from the CXF stack/URL.

I should also ask if there is a single example of this code actually 
working, because I can't find one..an example, tutorial, or otherwise.  
Has anyone successfully created a simple test project like mine below 
with a service interface/implementation either with a simple service 
definition with even one web method, either from wsimport generated 
artifacts or annoted interface/implementation classes approach.

I would be happy to see any actual simple working sample like mine if 
one existed, but I cannot find one.

Thanks again,
Chris

On 5/9/2011 10:40 PM, Willem Jiang wrote:
> Hi,
>
> Did you generate the DataService artifacts from WSDL?
> If not, you may need to add the ObjectFactory.class or jaxb.index file 
> to help the JAXB to create a right context for you.
>
> Willem
>
> On 5/10/11 7:41 PM, Chris Richmond wrote:
>>
>> Listed below is a simple isolated class which attempts to serve up my
>> JAX-WS service at the appropriate url and has and implementation class
>> which handles requests to it(DataService and DataServiceImpl,
>> respectively). These two classes work just fine running a pure CXF
>> implementation without camel.
>>
>> Below the code is the exception I am getting when starting up. Any ideas
>> why JAXB suddenly needs more artifacts?
>>
>>
>>
>> public class CamelTestMain {
>>
>> private static final String WEB_SERVICES_URL =
>> "cxf://http://qtmpc:9999/LiveActionDataService?dataFormat=PAYLOAD&wsdlURL=DataService.wsdl&serviceName={http://my.name.space}DataService&serviceClass=com.cameltest.DataService";

>>
>>
>>
>> /**
>> * @param args
>> */
>> public static void main(String[] args) {
>> // TODO Auto-generated method stub
>>
>>
>> CamelContext context = new DefaultCamelContext();
>> try {
>> context.addRoutes(new RouteBuilder() {
>> public void configure() {
>>
>>
>> SoapJaxbDataFormat soapDF = new
>> SoapJaxbDataFormat("com.cameltest.DataService", new
>> ServiceInterfaceStrategy(DataService.class, false));
>> DataService serverBean = new DataServiceImpl();
>>
>>
>> from(WEB_SERVICES_URL)
>> .onException(Exception.class)
>> .handled(true)
>> .marshal(soapDF)
>> .end()
>> .unmarshal(soapDF)
>> .bean(serverBean)
>> .marshal(soapDF);
>>
>>
>> }
>> });
>>
>> context.start();
>> Thread.sleep(10000000);
>> context.stop();
>> } catch (Exception e) {
>> // TODO Auto-generated catch block
>> e.printStackTrace();
>> }
>>
>>
>>
>> }
>>
>> }
>> --------------------------------------------------------------------
>>
>> javax.xml.bind.JAXBException: "com..cameltest.DataService" doesnt
>> contain ObjectFactory.class or jaxb.index
>> at
>> com.sun.xml.bind.v2.ContextFactory.createContext(ContextFactory.java:197) 
>>
>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>> at
>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) 
>>
>>
>> at
>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

>>
>>
>> at java.lang.reflect.Method.invoke(Method.java:597)
>> at javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:128)
>> at javax.xml.bind.ContextFinder.find(ContextFinder.java:277)
>> at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:372)
>> at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:337)
>> at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:244)
>> at
>> org.apache.camel.dataformat.soap.SoapJaxbDataFormat.createContext(SoapJaxbDataFormat.java:336)

>>
>>
>> at
>> org.apache.camel.converter.jaxb.JaxbDataFormat.doStart(JaxbDataFormat.java:251) 
>>
>>
>> at org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:67)
>> at org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:54)
>> at 
>> org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:60)
>> at
>> org.apache.camel.processor.MarshalProcessor.doStart(MarshalProcessor.java:85) 
>>
>>
>> at org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:67)
>> at org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:54)
>> at 
>> org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:60)
>> at 
>> org.apache.camel.util.ServiceHelper.startServices(ServiceHelper.java:74)
>> at
>> org.apache.camel.processor.DelegateProcessor.doStart(DelegateProcessor.java:76) 
>>
>>
>> at org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:67)
>> at org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:54)
>> at 
>> org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:60)
>> at 
>> org.apache.camel.util.ServiceHelper.startServices(ServiceHelper.java:74)
>> at
>> org.apache.camel.processor.DelegateAsyncProcessor.doStart(DelegateAsyncProcessor.java:77)

>>
>>
>> at
>> org.apache.camel.processor.interceptor.TraceInterceptor.doStart(TraceInterceptor.java:434)

>>
>>
>> at org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:67)
>> at org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:54)
>> at 
>> org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:60)
>> at 
>> org.apache.camel.util.ServiceHelper.startServices(ServiceHelper.java:74)
>> at
>> org.apache.camel.processor.RedeliveryErrorHandler.doStart(RedeliveryErrorHandler.java:852)

>>
>>
>> at org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:67)
>> at org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:54)
>> at 
>> org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:60)
>> at 
>> org.apache.camel.util.ServiceHelper.startServices(ServiceHelper.java:74)
>> at
>> org.apache.camel.processor.DefaultChannel.doStart(DefaultChannel.java:146) 
>>
>> at org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:67)
>> at org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:54)
>> at 
>> org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:60)
>> at 
>> org.apache.camel.util.ServiceHelper.startServices(ServiceHelper.java:86)
>> at org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:64)
>> at org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:54)
>> at 
>> org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:60)
>> at 
>> org.apache.camel.util.ServiceHelper.startServices(ServiceHelper.java:74)
>> at
>> org.apache.camel.processor.DefaultChannel.doStart(DefaultChannel.java:146) 
>>
>> at org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:67)
>> at org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:54)
>> at 
>> org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:60)
>> at 
>> org.apache.camel.util.ServiceHelper.startServices(ServiceHelper.java:86)
>> at
>> org.apache.camel.processor.MulticastProcessor.doStart(MulticastProcessor.java:893)

>>
>>
>> at org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:67)
>> at org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:54)
>> at 
>> org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:60)
>> at 
>> org.apache.camel.util.ServiceHelper.startServices(ServiceHelper.java:74)
>> at
>> org.apache.camel.processor.DelegateAsyncProcessor.doStart(DelegateAsyncProcessor.java:77)

>>
>>
>> at org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:67)
>> at org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:54)
>> at 
>> org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:60)
>> at 
>> org.apache.camel.util.ServiceHelper.startServices(ServiceHelper.java:74)
>> at
>> org.apache.camel.processor.DelegateAsyncProcessor.doStart(DelegateAsyncProcessor.java:77)

>>
>>
>> at org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:67)
>> at org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:54)
>> at 
>> org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:60)
>> at
>> org.apache.camel.impl.RouteService.startChildService(RouteService.java:250) 
>>
>> at org.apache.camel.impl.RouteService.warmUp(RouteService.java:146)
>> at
>> org.apache.camel.impl.DefaultCamelContext.doWarmUpRoutes(DefaultCamelContext.java:1832)

>>
>>
>> at
>> org.apache.camel.impl.DefaultCamelContext.safelyStartRouteServices(DefaultCamelContext.java:1758)

>>
>>
>> at
>> org.apache.camel.impl.DefaultCamelContext.doStartOrResumeRoutes(DefaultCamelContext.java:1548)

>>
>>
>> at
>> org.apache.camel.impl.DefaultCamelContext.doStartCamel(DefaultCamelContext.java:1440)

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

>>
>>
>> at org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:67)
>> at org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:54)
>> at
>> org.apache.camel.impl.DefaultCamelContext.start(DefaultCamelContext.java:1314) 
>>
>>
>> at com.cameltest.CamelTestMain.main(CamelTestMain.java:125)
>>
>>
>>
>
>


Mime
View raw message