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