我正在尝试将 CXF RESTful Web 服务与 Apache Camel 集成。当我向我的 Web 服务发送请求时出现以下异常:
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>