apache cxf-2.4.3 +spring-3.0.5釋出SOAP協議WebService服務
1.apache cxf-2.4.3匯入相關架包:
commons-net-3.3.jar
cxf-2.4.3.jar
geronimo-jaxws_2.2_spec-1.1.jar
geronimo-servlet_3.0_spec-1.0.jar
jaxb-api-2.2.6.jar
jaxb-impl-2.2.6.jar
neethi-3.0.1.jar
stax2-api-3.1.4.jar
woodstox-core-asl-4.4.1.jar
wsdl4j-1.6.3.jar
xmlschema-core-2.1.0.jar
2.ApplySOAPService介面
package demo.spring.service;
import java.util.List;
import javax.jws.WebService;
/**
* SOAP��WebService
* @author suyunlong
*
*/
@WebService
public interface ApplySOAPService {
public String returnSOAPFile(String applySerialNumber,SealFile sealFiles);
public String returnUsedEsealFile(String applySerialNumber,List<SealFile> sealFiles);
}
3.ApplySOAPServiceImpl介面實現類
package demo.spring.service;
import java.util.List;
import javax.jws.WebService;
/**
* SOAPЭ��WebService����ʵ����
* @author suyunlong
*
*/
@WebService(targetNamespace="http://demo.spring.service",
endpointInterface="demo.spring.service.ApplySOAPService")
public class ApplySOAPServiceImpl implements ApplySOAPService{
public String returnSOAPFile(String applySerialNumber,SealFile sealFiles) {
return "Hello "+applySerialNumber+","+sealFiles.getFileName();
}
public String returnUsedEsealFile(String applySerialNumber,List<SealFile> sealFiles){
return "Hello "+applySerialNumber+","+sealFiles.get(0).getFileName()+","+
sealFiles.size();
}
}
4.applicationContext.xml配置檔案
<?xml version="1.0" encoding="utf-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:jaxws="http://cxf.apache.org/jaxws"
xmlns:jaxrs="http://cxf.apache.org/jaxrs"
xmlns:cxf="http://cxf.apache.org/core"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd
http://www.springframework.org/schema/jee
http://www.springframework.org/schema/jee/spring-jee-3.0.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd
http://cxf.apache.org/core http://cxf.apache.org/schemas/core.xsd
http://cxf.apache.org/jaxrs http://cxf.apache.org/schemas/jaxrs.xsd"
default-autowire="byName" default-lazy-init="false">
<import resource="classpath:META-INF/cxf/cxf.xml"/>
<import resource="classpath:META-INF/cxf/cxf-servlet.xml"/>
<import resource="classpath:META-INF/cxf/cxf-extension-soap.xml"/>
<jaxws:endpoint id="applySOAPService"
implementor="demo.spring.service.ApplySOAPServiceImpl" address="/ApplySOAPService">
</jaxws:endpoint>
</beans>
5.web.xml配置檔案
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5"
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:applicationContext.xml</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<servlet>
<servlet-name>cxf</servlet-name>
<servlet-class>org.apache.cxf.transport.servlet.CXFServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>cxf</servlet-name>
<url-pattern>/services/*</url-pattern>
</servlet-mapping>
</web-app>
6.啟動Tomcat服務,瀏覽器中訪問http://localhost:8095/mybatis/services/ApplySOAPService?wsdl,顯示WSDL文件,即表示WebService服務釋出成功!相關文章
- soap協議的web服務協議Web
- Ajax通過SOAP協議呼叫Web服務協議Web
- Android程式使用SOAP呼叫遠端WebService服務AndroidWeb
- Linux網路服務-WebService之【HTTP協議簡介】(一)LinuxWebHTTP協議
- 瞭解下SOAP HTTP 協議HTTP協議
- SOAP協議規範(一)協議
- SOAP協議規範(二)協議
- Java呼叫使用SSL/HTTPS協議來傳輸的axis webservice服務JavaHTTP協議Web
- JAVA專案中釋出WebService服務—簡單例項JavaWeb單例
- SOAP和WebService真是垃圾。Web
- Thrift協議的服務模型協議模型
- Restful是什麼,SOAP Webservice和RESTful WebserviceRESTWeb
- 使用WebService釋出soap介面,並實現客戶端的https驗證Web客戶端HTTP
- WebService Soap架構設計Web架構
- Http get,post,soap協議的區別HTTP協議
- onvif soap 協議的錯誤程式碼協議
- (文摘)徹底理解webservice SOAP WSDLWeb
- Webservice呼叫方式:axis,soap詳解Web
- C#釋出WebServiceC#Web
- web服務中soap、wsdl、uddi理解Web
- phoenix API服務釋出API
- SOAP協議棧是令人尷尬的失敗?協議
- HTTP和SOAP完全就是兩個不同的協議HTTP協議
- webservice快速入門-SOAP和WSDL(三)Web
- python 搭建 webservice 服務端PythonWeb服務端
- CXF實現webService服務(一)Web
- GeoServer釋出影像WMTS服務Server
- PHP使用SOAP呼叫.net的WebService資料PHPWeb
- 使用dubbo+zookeeper釋出服務與呼叫服務
- syslog協議及rsyslog服務全解析協議
- 真正“搞”懂HTTP協議11之代理服務HTTP協議
- 使用InstallUtil釋出windows服務Windows
- Istio 1.2服務網格釋出
- 綠盟科技SASE服務正式釋出
- 翻譯-使用Spring WebService生成SOAP Web ServiceSpringWeb
- WebService通過SOAP頭進行身份驗證Web
- 待機顯示服務協議及隱私政策協議
- 動態主機配置協議DHCP及代理服務協議