cxf 簡單例子學習

2021-08-07 06:53:47 字數 1284 閱讀 8819

最少需要的jar:

cxf-2.3.3.jar

geronimo-annotation_1.0_spec-1.1.1.jar

geronimo-jaxws_2.2_spec-1.0.jar

geronimo-stax-api_1.0_spec-1.0.1.jar

geronimo-ws-metadata_2.0_spec-1.1.3.jar

jaxb-api-2.2.1.jar

jaxb-impl-2.2.1.1.jar

neethi-2.0.4.jar

wsdl4j-1.6.2.jar

xmlschema-1.4.7.jar

wstx-asl-3.2.9.jar

1:在web.xml 中配置

cxfservlet

org.apache.cxf.transport.servlet.cxfservlet

cxfservlet

/services/*若是struts配置為*.action

2:在spring的配置檔案中匯入spring-cxf.xml檔案

3:配置spring-cxf.xml

id="userservicecxf" 唯一性,最好為每乙個外放介面的管理的bean名稱

如下面的例子:

介面:@webservice

public inte***ce userservicecxf extends basedao

實現類:

@service("userservicecxf")

public class userservicecxfimpl extends basedaoimplimplements userservicecxf );

system.out.println(user);

return user.get(0);}}

cxf簡單說明

在cxf官網提供的例子中,直接執行main方法就可以發布執行cxf的webservice服務了。而無需借助tomcat這是為什麼呢?其實cxf 內建了 jetty servlet 容器 因此你不需要將你的程式部署到 tomcat 等 web 伺服器也可以正常發布web服務。wsdl檔案構成 詳見 假...

librbd 簡單學習例子

去年寫了個librbd的讀寫demo,今天找了好久才找到,寫到部落格裡記錄下 熟悉librbd的介面,從乙個demo 開始是個不錯的選擇 注釋就不詳細寫了,比較簡單 include include include include rados t init rados else return rado...

簡單委託例子

例子1 using system using system.collections.generic using system.text 例子2 using system using system.collections.generic using system.text namespace 介面 c...