cxf实现webservice接口的配置
1、web.xml配置
<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>
<!-- 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" serviceaddress="/receiveData"><jaxws:serviceBean> <bean ref="PageDAO"/><property name="baseDAO" ref="BaseDAO"/> </bean></jaxws:serviceBean></jaxws:server>
@WebMethodString getMedicalData(@WebParam(name="xmlStr")String xmlStr);
@Overridepublic 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;}}