camel-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Willem jiang <willem.ji...@gmail.com>
Subject Re: Isssue using POJO data format with Camel
Date Tue, 14 Aug 2012 01:47:05 GMT
It looks like CXF cannot load the right destination factory, you need to add 
<import resource="classpath:META-INF/cxf/cxf-extension-http-jetty.xml"/>


into you camel context file.

Which version of CXF are you using?
If you are using CXF 2.5.x you don't need to import lots of cxf related cxf.

Please send your mail to the user@ instead of dev@. 

-- 
Willem Jiang

FuseSource
Web: http://www.fusesource.com (http://www.fusesource.com/)
Blog: http://willemjiang.blogspot.com (http://willemjiang.blogspot.com/) (English)
          http://jnn.javaeye.com (http://jnn.javaeye.com/) (Chinese)
Twitter: willemjiang 
Weibo: willemjiang




On Tuesday, August 14, 2012 at 3:20 AM, camelraj wrote:

> Hi ,
> 
> I am trying to develop a small test for invoking SOAP Web Service by using
> POJO dta format. But I am getting following error.
> 
> My WSDL
> http://localhost:8080/hello-ws/HelloWorld?wsdl
> 
> <?xml version="1.0" encoding="UTF-8" ?> 
> - <wsdl:definitions name="HelloWorldImplService"
> targetNamespace="http://service.spring.demo/"
> xmlns:ns1="http://schemas.xmlsoap.org/soap/http"
> xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
> xmlns:tns="http://service.spring.demo/"
> xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
> xmlns:xsd="http://www.w3.org/2001/XMLSchema">
> - <wsdl:types>
> - <xs:schema attributeFormDefault="unqualified"
> elementFormDefault="unqualified"
> targetNamespace="http://service.spring.demo/"
> xmlns:tns="http://service.spring.demo/"
> xmlns:xs="http://www.w3.org/2001/XMLSchema">
> <xs:element name="complexParameters" type="tns:complexParameters" /> 
> <xs:element name="complexParametersResponse"
> type="tns:complexParametersResponse" /> 
> <xs:element name="echo" type="tns:echo" /> 
> <xs:element name="echoBoolean" type="tns:echoBoolean" /> 
> <xs:element name="echoBooleanResponse" type="tns:echoBooleanResponse" /> 
> <xs:element name="echoResponse" type="tns:echoResponse" /> 
> <xs:element name="getInvocationCount" type="tns:getInvocationCount" /> 
> <xs:element name="getInvocationCountResponse"
> type="tns:getInvocationCountResponse" /> 
> <xs:element name="ping" type="tns:ping" /> 
> <xs:element name="pingResponse" type="tns:pingResponse" /> 
> <xs:element name="sayHello" type="tns:sayHello" /> 
> <xs:element name="sayHelloResponse" type="tns:sayHelloResponse" /> 
> <xs:element name="sayHi" type="tns:sayHi" /> 
> <xs:element name="sayHiResponse" type="tns:sayHiResponse" /> 
> - <xs:complexType name="sayHi">
> - <xs:sequence>
> <xs:element minOccurs="0" name="arg0" type="xs:string" /> 
> </xs:sequence>
> </xs:complexType>
> - <xs:complexType name="sayHiResponse">
> - <xs:sequence>
> <xs:element minOccurs="0" name="return" type="xs:string" /> 
> </xs:sequence>
> </xs:complexType>
> - <xs:complexType name="echoBoolean">
> - <xs:sequence>
> <xs:element minOccurs="0" name="arg0" type="xs:boolean" /> 
> </xs:sequence>
> </xs:complexType>
> - <xs:complexType name="echoBooleanResponse">
> - <xs:sequence>
> <xs:element minOccurs="0" name="return" type="xs:boolean" /> 
> </xs:sequence>
> </xs:complexType>
> - <xs:complexType name="ping">
> <xs:sequence /> 
> </xs:complexType>
> - <xs:complexType name="pingResponse">
> <xs:sequence /> 
> </xs:complexType>
> - <xs:complexType name="echo">
> - <xs:sequence>
> <xs:element minOccurs="0" name="arg0" type="xs:string" /> 
> </xs:sequence>
> </xs:complexType>
> - <xs:complexType name="echoResponse">
> - <xs:sequence>
> <xs:element minOccurs="0" name="return" type="xs:string" /> 
> </xs:sequence>
> </xs:complexType>
> - <xs:complexType name="getInvocationCount">
> <xs:sequence /> 
> </xs:complexType>
> - <xs:complexType name="getInvocationCountResponse">
> - <xs:sequence>
> <xs:element name="return" type="xs:int" /> 
> </xs:sequence>
> </xs:complexType>
> - <xs:complexType name="complexParameters">
> - <xs:sequence>
> <xs:element maxOccurs="unbounded" minOccurs="0" name="arg0"
> type="xs:string" /> 
> <xs:element maxOccurs="unbounded" minOccurs="0" name="arg1"
> type="xs:string" /> 
> </xs:sequence>
> </xs:complexType>
> - <xs:complexType name="complexParametersResponse">
> - <xs:sequence>
> <xs:element minOccurs="0" name="return" type="xs:string" /> 
> </xs:sequence>
> </xs:complexType>
> - <xs:complexType name="sayHello">
> <xs:sequence /> 
> </xs:complexType>
> - <xs:complexType name="sayHelloResponse">
> - <xs:sequence>
> <xs:element minOccurs="0" name="return" type="xs:string" /> 
> </xs:sequence>
> </xs:complexType>
> <xs:element name="Exception" type="tns:Exception" /> 
> - <xs:complexType name="Exception">
> - <xs:sequence>
> <xs:element minOccurs="0" name="message" type="xs:string" /> 
> </xs:sequence>
> </xs:complexType>
> </xs:schema>
> </wsdl:types>
> - <wsdl:message name="getInvocationCountResponse">
> <wsdl:part element="tns:getInvocationCountResponse" name="parameters" /> 
> </wsdl:message>
> - <wsdl:message name="echoBoolean">
> <wsdl:part element="tns:echoBoolean" name="parameters" /> 
> </wsdl:message>
> - <wsdl:message name="sayHelloResponse">
> <wsdl:part element="tns:sayHelloResponse" name="parameters" /> 
> </wsdl:message>
> - <wsdl:message name="echoResponse">
> <wsdl:part element="tns:echoResponse" name="parameters" /> 
> </wsdl:message>
> - <wsdl:message name="complexParametersResponse">
> <wsdl:part element="tns:complexParametersResponse" name="parameters" /> 
> </wsdl:message>
> - <wsdl:message name="ping">
> <wsdl:part element="tns:ping" name="parameters" /> 
> </wsdl:message>
> - <wsdl:message name="sayHi">
> <wsdl:part element="tns:sayHi" name="parameters" /> 
> </wsdl:message>
> - <wsdl:message name="getInvocationCount">
> <wsdl:part element="tns:getInvocationCount" name="parameters" /> 
> </wsdl:message>
> - <wsdl:message name="sayHiResponse">
> <wsdl:part element="tns:sayHiResponse" name="parameters" /> 
> </wsdl:message>
> - <wsdl:message name="sayHello">
> <wsdl:part element="tns:sayHello" name="parameters" /> 
> </wsdl:message>
> - <wsdl:message name="echo">
> <wsdl:part element="tns:echo" name="parameters" /> 
> </wsdl:message>
> - <wsdl:message name="pingResponse">
> <wsdl:part element="tns:pingResponse" name="parameters" /> 
> </wsdl:message>
> - <wsdl:message name="Exception">
> <wsdl:part element="tns:Exception" name="Exception" /> 
> </wsdl:message>
> - <wsdl:message name="echoBooleanResponse">
> <wsdl:part element="tns:echoBooleanResponse" name="parameters" /> 
> </wsdl:message>
> - <wsdl:message name="complexParameters">
> <wsdl:part element="tns:complexParameters" name="parameters" /> 
> </wsdl:message>
> - <wsdl:portType name="HelloWorld">
> - <wsdl:operation name="sayHi">
> <wsdl:input message="tns:sayHi" name="sayHi" /> 
> <wsdl:output message="tns:sayHiResponse" name="sayHiResponse" /> 
> </wsdl:operation>
> - <wsdl:operation name="echoBoolean">
> <wsdl:input message="tns:echoBoolean" name="echoBoolean" /> 
> <wsdl:output message="tns:echoBooleanResponse" name="echoBooleanResponse"
> /> 
> </wsdl:operation>
> - <wsdl:operation name="ping">
> <wsdl:input message="tns:ping" name="ping" /> 
> <wsdl:output message="tns:pingResponse" name="pingResponse" /> 
> </wsdl:operation>
> - <wsdl:operation name="echo">
> <wsdl:input message="tns:echo" name="echo" /> 
> <wsdl:output message="tns:echoResponse" name="echoResponse" /> 
> <wsdl:fault message="tns:Exception" name="Exception" /> 
> </wsdl:operation>
> - <wsdl:operation name="getInvocationCount">
> <wsdl:input message="tns:getInvocationCount" name="getInvocationCount" /> 
> <wsdl:output message="tns:getInvocationCountResponse"
> name="getInvocationCountResponse" /> 
> </wsdl:operation>
> - <wsdl:operation name="complexParameters">
> <wsdl:input message="tns:complexParameters" name="complexParameters" /> 
> <wsdl:output message="tns:complexParametersResponse"
> name="complexParametersResponse" /> 
> </wsdl:operation>
> - <wsdl:operation name="sayHello">
> <wsdl:input message="tns:sayHello" name="sayHello" /> 
> <wsdl:output message="tns:sayHelloResponse" name="sayHelloResponse" /> 
> </wsdl:operation>
> </wsdl:portType>
> - <wsdl:binding name="HelloWorldImplServiceSoapBinding"
> type="tns:HelloWorld">
> <soap:binding style="document"
> transport="http://schemas.xmlsoap.org/soap/http" /> 
> - <wsdl:operation name="sayHi">
> <soap:operation soapAction="" style="document" /> 
> - <wsdl:input name="sayHi">
> <soap:body use="literal" /> 
> </wsdl:input>
> - <wsdl:output name="sayHiResponse">
> <soap:body use="literal" /> 
> </wsdl:output>
> </wsdl:operation>
> - <wsdl:operation name="echoBoolean">
> <soap:operation soapAction="" style="document" /> 
> - <wsdl:input name="echoBoolean">
> <soap:body use="literal" /> 
> </wsdl:input>
> - <wsdl:output name="echoBooleanResponse">
> <soap:body use="literal" /> 
> </wsdl:output>
> </wsdl:operation>
> - <wsdl:operation name="ping">
> <soap:operation soapAction="" style="document" /> 
> - <wsdl:input name="ping">
> <soap:body use="literal" /> 
> </wsdl:input>
> - <wsdl:output name="pingResponse">
> <soap:body use="literal" /> 
> </wsdl:output>
> </wsdl:operation>
> - <wsdl:operation name="echo">
> <soap:operation soapAction="" style="document" /> 
> - <wsdl:input name="echo">
> <soap:body use="literal" /> 
> </wsdl:input>
> - <wsdl:output name="echoResponse">
> <soap:body use="literal" /> 
> </wsdl:output>
> - <wsdl:fault name="Exception">
> <soap:fault name="Exception" use="literal" /> 
> </wsdl:fault>
> </wsdl:operation>
> - <wsdl:operation name="complexParameters">
> <soap:operation soapAction="" style="document" /> 
> - <wsdl:input name="complexParameters">
> <soap:body use="literal" /> 
> </wsdl:input>
> - <wsdl:output name="complexParametersResponse">
> <soap:body use="literal" /> 
> </wsdl:output>
> </wsdl:operation>
> - <wsdl:operation name="getInvocationCount">
> <soap:operation soapAction="" style="document" /> 
> - <wsdl:input name="getInvocationCount">
> <soap:body use="literal" /> 
> </wsdl:input>
> - <wsdl:output name="getInvocationCountResponse">
> <soap:body use="literal" /> 
> </wsdl:output>
> </wsdl:operation>
> - <wsdl:operation name="sayHello">
> <soap:operation soapAction="" style="document" /> 
> - <wsdl:input name="sayHello">
> <soap:body use="literal" /> 
> </wsdl:input>
> - <wsdl:output name="sayHelloResponse">
> <soap:body use="literal" /> 
> </wsdl:output>
> </wsdl:operation>
> </wsdl:binding>
> - <wsdl:service name="HelloWorldImplService">
> - <wsdl:port binding="tns:HelloWorldImplServiceSoapBinding"
> name="HelloWorldImplPort">
> <soap:address location="http://localhost:8080/hello-ws/HelloWorld" /> 
> </wsdl:port>
> </wsdl:service>
> </wsdl:definitions>
> 
> MY Camel Route
> 
> <?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:cxf="http://camel.apache.org/schema/cxf"
> xsi:schemaLocation="
> http://www.springframework.org/schema/beans
> http://www.springframework.org/schema/beans/spring-beans.xsd
> http://camel.apache.org/schema/cxf
> http://camel.apache.org/schema/cxf/camel-cxf.xsd
> http://camel.apache.org/schema/spring
> http://camel.apache.org/schema/spring/camel-spring.xsd
> ">
> 
> <import resource="classpath:META-INF/cxf/cxf.xml"/>
> <import resource="classpath:META-INF/cxf/cxf-servlet.xml"/>
> <import resource="classpath:META-INF/cxf/cxf-extension-soap.xml"/>
> 
> <bean id="processor1" class="camel.router.Processor1"/>
> 
> <cxf:cxfEndpoint id="routerEndpoint"
> address="http://localhost:8080/hello-ws/HelloWorld"
> serviceClass="demo.spring.service.HelloWorld"/>
> 
> 
> <camelContext id="test_context"
> xmlns="http://camel.apache.org/schema/spring">
> <route>
> <from uri="cxf:bean:routerEndpoint"/>
> <process ref="processor1"/>
> </route>
> </camelContext>
> 
> </beans>
> 
> Processor class 
> package camel.router;
> 
> import java.util.ArrayList;
> import java.util.List;
> import java.util.Map;
> 
> import org.apache.camel.Exchange;
> import org.apache.camel.component.cxf.common.message.CxfConstants;
> import org.apache.camel.util.CastUtils;
> import org.apache.cxf.endpoint.Client;
> 
> public class Processor1 implements org.apache.camel.Processor{
> 
> public void process(Exchange exchange) throws Exception {
> 
> System.out.println("Inside process###########");
> 
> final List<String> params = new ArrayList<String>();
> 
> params.add("Hello World!");
> 
> exchange.getIn().setBody(params);
> 
> exchange.getIn().setHeader(CxfConstants.OPERATION_NAME, "echo");
> 
> //exchange.getIn().setHeader(Exchange.FILE_NAME, "testFile");
> 
> //exchange.getIn().setHeader("requestObject", new DefaultCxfBinding());
> 
> org.apache.camel.Message out = exchange.getOut();
> 
> String result = out.getBody(String.class);
> 
> System.out.println("Received output text: " + result);
> 
> Map<String, Object> responseContext = CastUtils.cast((Map<?,
> ?>)out.getHeader(Client.RESPONSE_CONTEXT));
> 
> System.out.println(responseContext);
> 
> }
> }
> 
> Exception
> ----------
> 
> 12/08/13 11:59:33 INFO factory.ReflectionServiceFactoryBean: Creating
> Service {http://service.spring.demo/}HelloWorldService from class
> demo.spring.service.HelloWorld
> 12/08/13 11:59:34 ERROR http.HTTPTransportFactory: Cannot find any
> registered HttpDestinationFactory from the Bus.
> 12/08/13 11:59:34 INFO spring.SpringCamelContext: Apache Camel 2.10.0
> (CamelContext: test_context) is shutting down
> 12/08/13 11:59:34 INFO converter.DefaultTypeConverter: TypeConverterRegistry
> utilization[attempts=1, hits=0, misses=1, failures=0] mappings[total=194,
> misses=1]
> 12/08/13 11:59:34 INFO spring.SpringCamelContext: Apache Camel 2.10.0
> (CamelContext: test_context) is shutdown in 0.016 seconds. Uptime 1.203
> seconds.
> 12/08/13 11:59:34 INFO main.MainSupport: Apache Camel 2.10.0 stopping
> *************************************
> Error occurred while running main from: org.apache.camel.spring.Main
> java.lang.reflect.InvocationTargetException
> 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 org.apache.camel.maven.RunMojo$1.run(RunMojo.java:440)
> at java.lang.Thread.run(Thread.java:662)
> Caused by: org.apache.camel.RuntimeCamelException:
> org.apache.cxf.service.factory.ServiceConstructionException
> at
> org.apache.camel.util.ObjectHelper.wrapRuntimeCamelException(ObjectHelper.java:1280)
> at
> org.apache.camel.spring.SpringCamelContext.onApplicationEvent(SpringCamelContext.java:120)
> at
> org.apache.camel.spring.CamelContextFactoryBean.onApplicationEvent(CamelContextFactoryBean.java:280)
> at
> org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:97)
> at
> org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:303)
> at
> org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:911)
> at
> org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:428)
> 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:186)
> at org.apache.camel.spring.Main.doStart(Main.java:140)
> at org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:60)
> at org.apache.camel.main.MainSupport.run(MainSupport.java:140)
> at org.apache.camel.main.MainSupport.run(MainSupport.java:326)
> at org.apache.camel.spring.Main.main(Main.java:73)
> ... 6 more
> Caused by: org.apache.cxf.service.factory.ServiceConstructionException
> at
> org.apache.cxf.frontend.ServerFactoryBean.create(ServerFactoryBean.java:178)
> at
> org.apache.cxf.jaxws.JaxWsServerFactoryBean.create(JaxWsServerFactoryBean.java:205)
> at org.apache.camel.component.cxf.CxfConsumer.<init>(CxfConsumer.java:226)
> at
> org.apache.camel.component.cxf.CxfEndpoint.createConsumer(CxfEndpoint.java:197)
> at
> org.apache.camel.impl.EventDrivenConsumerRoute.addServices(EventDrivenConsumerRoute.java:65)
> at
> org.apache.camel.impl.DefaultRoute.onStartingServices(DefaultRoute.java:80)
> at org.apache.camel.impl.RouteService.warmUp(RouteService.java:133)
> at
> org.apache.camel.impl.DefaultCamelContext.doWarmUpRoutes(DefaultCamelContext.java:1941)
> at
> org.apache.camel.impl.DefaultCamelContext.safelyStartRouteServices(DefaultCamelContext.java:1869)
> at
> org.apache.camel.impl.DefaultCamelContext.doStartOrResumeRoutes(DefaultCamelContext.java:1662)
> at
> org.apache.camel.impl.DefaultCamelContext.doStartCamel(DefaultCamelContext.java:1550)
> at
> org.apache.camel.impl.DefaultCamelContext.doStart(DefaultCamelContext.java:1427)
> at
> org.apache.camel.spring.SpringCamelContext.doStart(SpringCamelContext.java:179)
> at org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:60)
> at
> org.apache.camel.impl.DefaultCamelContext.start(DefaultCamelContext.java:1395)
> at
> org.apache.camel.spring.SpringCamelContext.maybeStart(SpringCamelContext.java:228)
> at
> org.apache.camel.spring.SpringCamelContext.onApplicationEvent(SpringCamelContext.java:118)
> ... 19 more
> Caused by: java.io.IOException: Cannot find any registered
> HttpDestinationFactory from the Bus.
> at
> org.apache.cxf.transport.http.HTTPTransportFactory.getDestination(HTTPTransportFactory.java:270)
> at
> org.apache.cxf.binding.soap.SoapTransportFactory.getDestination(SoapTransportFactory.java:134)
> at org.apache.cxf.endpoint.ServerImpl.initDestination(ServerImpl.java:93)
> at org.apache.cxf.endpoint.ServerImpl.<init>(ServerImpl.java:72)
> at
> org.apache.cxf.frontend.ServerFactoryBean.create(ServerFactoryBean.java:160)
> ... 35 more
> 
> 
> 
> --
> View this message in context: http://camel.465427.n5.nabble.com/Isssue-using-POJO-data-format-with-Camel-tp5717266.html
> Sent from the Camel Development mailing list archive at Nabble.com (http://Nabble.com).




Mime
View raw message