5
我试图用JAXRSClientFactory调用我的RESTful服务 - 而我坚持与请求/响应映射类型提供的配置(我需要序列列表)提交定制的请求marshallers到JAXRSClientFactory
的代码看起来是这样的:
JAXRSClientFactory.create("http://localhost:8080/", MyCoolService.class, "/path/to/client/config.xml");
config.xml文件看起来像:
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:jaxrs="http://cxf.apache.org/jaxrs"
xsi:schemaLocation="
http://cxf.apache.org/jaxrs
http://cxf.apache.org/schemas/jaxrs.xsd
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
">
<jaxrs:client id="testClient" createdFromAPI="true">
<jaxrs:providers>
<bean class="my.provider.Class"/>
</jaxrs:providers>
</jaxrs:client>
</beans>
现在
调试客户端代码的时候,我可以org.apache.cxf.jaxrs.provide内看到, r.ProviderFactory有通话
MessageBodyWriter<T> mw = chooseMessageWriter(messageWriters,
bodyType,
parameterType,
parameterAnnotations,
mediaType,
m);
然而messageWriters不包含我的供应商。我的代码有什么问题以及如何正确提供MessageBodyWriter?提前致谢!
现在有这将清除代码一点点一config.getHttpConduit()方法。 – 2012-06-11 18:31:06