2012-04-20 2 views
0

Я пытаюсь интегрировать веб-сервисы CXF с Apache Camel. Я получаю следующее исключение, когда я отправить запрос на мой веб-сервиса:TypeConversion Исключение: Apache Camel и CXF

Caused by: org.apache.camel.NoTypeConversionAvailableException: No type converter available to convert from type: org.apache.cxf.message.MessageContentsList to the required type: java.io.InputStream with value [null] 
    at org.apache.camel.impl.converter.BaseTypeConverterRegistry.mandatoryConvertTo(BaseTypeConverterRegistry.java:147) 
    at org.apache.camel.impl.MessageSupport.getMandatoryBody(MessageSupport.java:100) 
    ... 68 more 

Я вставив раздел моего конфигурации XML для обзора:

<jaxrs:server id="restContainer" address="/" staticSubresourceResolution="true"> 

<jaxrs:serviceBeans> 
    <ref bean="FooBar"/> 
</jaxrs:serviceBeans> 

<jaxrs:providers> 
    <bean class="org.apache.cxf.jaxrs.provider.JSONProvider"> 
    <property name="dropRootElement" value="true"/> 
    <property name="supportUnwrapped" value="true"/> 
</jaxrs:providers> 

<camelcxf:rsServer id="rsServer" address="http://localhost:port/MyApplication/rest/foobar" serviceClass="com.camel.example.FooBar"/> 

<camel:camelContext id="camelContext-1"> 
    <camel:route> 
     <camel:from uri="cxfrs:bean:rsServer"/> 
     <camel:to uri="http://www.google.com"/> 
    </camel:route> 
</camel:camelContext> 
+0

Попробуйте добавить это в свой весенний конфиг где-нибудь.

+0

У меня уже есть это в myconfig xml – Sikorski

+0

Какую версию Camel и CXF вы используете? Похоже, что сообщение из CXF пусто (null), и поэтому преобразование типа не выполняется. Что вы публикуете в службе RS? –

ответ

2

решить все ошибки .. на самом деле проблема была не тогда, когда мой сервер cxf попадал, это происходит, когда обмен был в части «to» ... Мне пришлось добавить процессор между от и до и переопределить все CamelHttpUri, CamelHttpMethod и т. д. ... чтобы он работал.

<camelcxf:rsServer id="rsServer" address="http://localhost:port/MyApplication/rest/foobar serviceClass="com.camel.example.FooBar" /> <camel:camelContext id="camelContext-1"> <camel:route> 
<camel:from uri="cxfrs:bean:rsServer" /> 
<camel:process ref="customInProcessor" /> 
<camel:to uri="http://www.google.com" /> 
</camel:route> 
    </camel:camelContext> 

<bean id="customInProcessor" class="com.camel.MyInProcessor" /> 
Смежные вопросы