我有SOAP
个CXF
网络服务,并通过以下方式发布Spring
:
应用context.xml中:
<jaxws:endpoint implementor="de.test.MyService" address="/MyService" />
REST
服务的等价物是什么?
答案 0 :(得分:1)
CXF 2.7.3
<bean id="restService" class="de.test.MyServiceRest" />
<jaxrs:server id="restServiceCXF" address="/MyServiceRest">
<jaxrs:serviceBeans>
<ref bean="restService" />
</jaxrs:serviceBeans>
</jaxrs:server>
json版本
<jaxrs:server id="restServiceCXF" address="/MyServiceRest">
<jaxrs:serviceBeans>
<ref bean="restService" />
</jaxrs:serviceBeans>
<jaxrs:providers>
<ref bean='jsonProvider' />
</jaxrs:providers>
</jaxrs:server>
<bean id="jsonProvider" class="org.apache.cxf.jaxrs.provider.json.JSONProvider"/>
xml版
<jaxrs:server id="restServiceCXF" address="/MyServiceRest">
<jaxrs:serviceBeans>
<ref bean="restService" />
</jaxrs:serviceBeans>
<jaxrs:providers>
<ref bean='jaxbProvider' />
</jaxrs:providers>
</jaxrs:server>
<bean id="jaxbProvider" class="org.apache.cxf.jaxrs.provider.JAXBElementProvider"/>
答案 1 :(得分:0)
<jaxrs:server serviceClass="de.test.MyServiceRest" address="/MyServiceRest" />