我已经在我的cxf.xml文件中创建了一个cxf tag服务,我有以下标记。class="com.company.auth.dataobjects.VideoStatsTable“id="videoStatsTable”bean
据我所知,Spring应该为我创建这个对象。问题是我不确定如何访问它。看起来我好像需要servletContext,但是我不在servlet中,我在WS中,我不知道该怎么做?
W
发布于 2009-12-02 04:47:56
Spring有一种声明web服务的简化方式(使用cxf)。
在applicationContext.xml
中,将xmlns:jaxws="http://cxf.apache.org/jaxws"
添加到根标记(<beans>
)中,然后
http://cxf.apache.org/core
http://cxf.apache.org/schemas/core.xsd
http://cxf.apache.org/jaxws
http://cxf.apache.org/schemas/jaxws.xsd
发送到您的schemaLocation
然后添加:
<!-- Loading CXF modules -->
<import resource="classpath:META-INF/cxf/cxf.xml" />
<import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" />
<import resource="classpath:META-INF/cxf/cxf-servlet.xml" />
最后声明你的WebService实现:
<jaxws:endpoint id="MyWebService" implementor="#MyWebServiceImpl"
address="/myWebServiceAddress" />
其中#MyWebServiceImpl
是bean的ID。您可以自由地将任何其他spring依赖项注入到该bean中。
然后就可以通过http://yourhost/cxfuri/myWebServiceAddress
访问web服务(其中cxfuri是您的CXF Servlet的映射)
https://stackoverflow.com/questions/1827051
复制相似问题