ctx webservice 调整 spring 简单实例

ctx webservice 整合 spring 简单实例

最近正好在做一个webservice的相关事情,这边就简单的介绍一下:

 

 

一.spring 托管的webservice 

1.web.xml配置文件内容
<servlet>
<servlet-name>CXFServlet</servlet-name>
<servlet-class>
org.apache.cxf.transport.servlet.CXFServlet
</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>CXFServlet</servlet-name>
<url-pattern>/services/*</url-pattern>
</servlet-mapping>
2.spring 配置内容
<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"/>

<jaxws:endpoint id="ApplySuperviseService" address="/ApplySuperviseService" implementor="cn.com.trueway.cc.ws.ApplySuperviseServiceImpl"/>
<jaxws:endpoint id="LmService" address="/LmService" implementor="cn.com.trueway.cc.ws.LmServiceImpl"/>

 

3.service
@WebService
public interface LmService {

@WebMethod
public String getSzmailFromLm(@WebParam(name="InfoXML")String InfoXML);

@WebMethod
public String feedBackToLm(@WebParam(name="InfoXML")String InfoXML);

@WebMethod
public String trunBackToLm(@WebParam(name="InfoXML")String InfoXML);

}

 

4.service 实现

@WebService(endpointInterface = "cn.com.trueway.cc.ws.LmService", serviceName = "LmService")
public class LmServiceImpl implements LmService {

 

 

详情:可以见如下链接:http://www.cnblogs.com/hoojo/archive/2011/03/30/1999563.html