基本cxfrs RESTful JAX-RS服务
我试图让一个基本的CXF RS JAX-RS示例正常工作。不幸的是,对我想要返回HTML的资源的访问似乎根本没有调用该资源 以下是SpringBean的摘录:基本cxfrs RESTful JAX-RS服务,rest,apache-camel,Rest,Apache Camel,我试图让一个基本的CXF RS JAX-RS示例正常工作。不幸的是,对我想要返回HTML的资源的访问似乎根本没有调用该资源 以下是SpringBean的摘录: <cxf:rsServer id="rsServer" address="http://localhost:9099/route" serviceClass="com.example.HelloResource"/> <bean id="HelloResource" class="com.e
<cxf:rsServer id="rsServer" address="http://localhost:9099/route"
serviceClass="com.example.HelloResource"/>
<bean id="HelloResource" class="com.example.HelloResource"/>
<camelContext xmlns="http://camel.apache.org/schema/spring">
<route>
<from uri="cxfrs:bean:rsServer"/>
<to uri="log:AFTER?showAll=true"/>
</route>
</camelContext>
从下面的日志摘录中可以看到,Springbean已经构建,它将调用的方法似乎是正确的,但实际上似乎没有调用该方法:
14:55:27,614 | INFO | qtp137557963-131 | HelloResource | 180 - hello.jar - 0.0.0 | Creating HelloResource ...
14:55:27,616 | INFO | qtp137557963-131 | AFTER | 96 - org.apache.camel.camel-core - 2.10.4 | Exchange[Id:ASDF63648-1398714852208-0-3, ExchangePattern:InOut, Properties:{CamelToEndpoint=log://AFTER?showAll=true, CamelCreatedTimestamp=Mon Apr 28 14:55:27 CDT 2014}, Headers:{CamelHttpUri=/route/hello,CamelCxfMessage=org.apache.cxf.message.XMLMessage@76159b6f, CamelHttpPath=/hello, breadcrumbId=ASDFAS3987148522080-4,CamelCxfRsResponseGenericType=class java.lang.String, User-Agent=curl/7.21.1 (i686-pc-mingw32) libcurl/7.21.1 OpenSSL/0.9.8r zlib/1.2.3,operationName=hello, Accept=*/*, Content-Type=null, CamelHttpMethod=GET, CamelCxfRsOperationResourceInfoStack=[org.apache.cxf.jaxrs.model.MethodInvocationInfo@354563cc], Host=localhost:9099, CamelAcceptContentType=*/*, CamelCxfRsResponseClass=class java.lang.String},BodyType:org.apache.cxf.message.MessageContentsList, Body:[], Out: null]
我肯定我做错了什么。如果有人能提供任何帮助,我将不胜感激
谢谢 尝试使用SOAP ui进行测试,这将非常有帮助。由于找到了一个链接,我找到了自己问题的答案。显然,我使用的是Camel-CXF表示法,但应该使用Apache-CXF-JAX-RS服务器,因为我不需要Camel路由。我仍然不明白在Camel-CXF表示法中如何调用JAX-RS资源,但一旦我添加了表示法,它就工作了。
curl localhost:9099/route/hello
14:55:27,614 | INFO | qtp137557963-131 | HelloResource | 180 - hello.jar - 0.0.0 | Creating HelloResource ...
14:55:27,616 | INFO | qtp137557963-131 | AFTER | 96 - org.apache.camel.camel-core - 2.10.4 | Exchange[Id:ASDF63648-1398714852208-0-3, ExchangePattern:InOut, Properties:{CamelToEndpoint=log://AFTER?showAll=true, CamelCreatedTimestamp=Mon Apr 28 14:55:27 CDT 2014}, Headers:{CamelHttpUri=/route/hello,CamelCxfMessage=org.apache.cxf.message.XMLMessage@76159b6f, CamelHttpPath=/hello, breadcrumbId=ASDFAS3987148522080-4,CamelCxfRsResponseGenericType=class java.lang.String, User-Agent=curl/7.21.1 (i686-pc-mingw32) libcurl/7.21.1 OpenSSL/0.9.8r zlib/1.2.3,operationName=hello, Accept=*/*, Content-Type=null, CamelHttpMethod=GET, CamelCxfRsOperationResourceInfoStack=[org.apache.cxf.jaxrs.model.MethodInvocationInfo@354563cc], Host=localhost:9099, CamelAcceptContentType=*/*, CamelCxfRsResponseClass=class java.lang.String},BodyType:org.apache.cxf.message.MessageContentsList, Body:[], Out: null]