intellij idea怎么集成cxf

2025-05-16 15:01:58
推荐回答(2个)
回答1:

1、要在eclipse中采用自带的数据库管理器(Data Management),连通你的数据库:
2、然后选择数据库,这里用的oracle,然后给个名字,如MyOracle。
3、选择数据库版本,这里是oracle 10g版本,可以为该配置另起个名字。
4、然后选择相应数据库版本的jar包。
5、Properties下的General选项卡内容,同样是连接数据库的信息,配置完后点击Test Connection按钮测试是否能连通数据库。
6、然后点击Next,再确认无误后,单击Finish。
7、 生成hibernate实体类打开Hibernate Configurations窗口。
8、打开窗口右击,点击Add Configuration...
9、Console configuration选择刚刚配置好的hibernate,点击Refresh按钮,就会出现数据库的全部schema,找到你的数据库,然后将其 Include到右侧窗口里,然后点击Finish按钮完成hibernate.reveng.xml的创建。
10、选择Exporters选项卡,勾选Domain code和Hibernate XML Mappings,然后点击Run按钮

回答2:

---- 导入包到maven ----
org.apache.cxf
---- 增加POM ----


org.apache.cxf
cxf-rt-frontend-jaxws
3.1.6


org.apache.cxf
cxf-rt-transports-http
3.1.6


org.apache.cxf
cxf-rt-frontend-jaxrs
3.1.6

----创建cxf-servlet.xml 并放到和applicationContext.xml同目录即可----

xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:jaxws="http://cxf.apache.org/jaxws"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
http://cxf.apache.org/jaxws
http://cxf.apache.org/schemas/jaxws.xsd">



-----applicationContext.xml 增加-----

---- web.xml 增加 ----


CXFServlet
org.apache.cxf.transport.servlet.CXFServlet
0


CXFServlet
/webService/*

---- 测试例子 ----
--接口--
package com.vanda.app.bjzfw.cxfservice;
import javax.jws.WebMethod;
import javax.jws.WebService;
@WebService()
public interface CxfService {
@WebMethod
String mess(String xml);
}
--实现类--
package com.vanda.app.bjzfw.cxfservice;
import javax.jws.WebService;
@WebService
public class CxfServiceImpl implements CxfService {
@Override
public String mess(String xml) {
return "xml info";
}
}
---- 访问地址
http://localhost:8080/项目名称/webService/cxfserver?wsdl