1、web.xml配置
class="java"><servlet>
<servlet-name>CXFServlet</servlet-name>
<servlet-class>org.apache.cxf.transport.servlet.CXFServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>CXFServlet</servlet-name>
<url-pattern>/services/*</url-pattern>
</servlet-mapping>
2、
接口配置
<!-- apache cxf 与 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:server id="receiveData" serviceClass="com.gd.service.IClassicCasesManager" address="/receiveData">
<jaxws:serviceBean>
<bean class="com.gd.service.impl.ClassicCasesManagerImpl">
<property name="pageDAO" ref="PageDAO"/>
<property name="baseDAO" ref="BaseDAO"/>
</bean>
</jaxws:serviceBean>
</jaxws:server>
接口类
@WebMethod
String getMedicalData(@WebParam(name="xmlStr")String xmlStr);
实现类
@Override
public ClassicCases findClassicCasesById(String id) {
if (id != null && !id.equals("")) {
String hql = "from ClassicCases where id=?";
List<ClassicCases> list = this.baseDAO.findByHql(hql,
new Object[] { Integer.parseInt(id) });
if (list != null && list.size() > 0) {
return list.get(0);
} else {
return null;
}
} else {
return null;
}
}
这是一个简单的实现,具体复杂的请参照API等。