Spring使用CFX发布Webservice

来源:互联网 发布:网络安全保密基础知识 编辑:程序博客网 时间:2024/06/05 11:31
spring配置:
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:context="http://www.springframework.org/schema/context"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:jaxws="http://cxf.apache.org/jaxws"xsi:schemaLocation="   http://www.springframework.org/schema/beans    http://www.springframework.org/schema/beans/spring-beans.xsd    http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd"> <!-- Import apache CXF bean definition 固定-->      <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" /> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:context="http://www.springframework.org/schema/context"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:jaxws="http://cxf.apache.org/jaxws"xsi:schemaLocation="   http://www.springframework.org/schema/beans    http://www.springframework.org/schema/beans/spring-beans.xsd    http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd"> <!-- Import apache CXF bean definition 固定-->      <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" /> <bean id="gpmsWebServiceService" class="com.haier.leg.contract.gpmscontract.service.impl.GpmsWebServiceImpl"/>    <jaxws:server id="gpmsWebServiceServiceWs" serviceClass="com.haier.leg.contract.gpmscontract.service.GpmsWebServiceService" address="/gpmsqr"><jaxws:serviceBean> <ref bean="gpmsWebServiceService" /></jaxws:serviceBean></jaxws:server></beans>
service:
import javax.jws.WebService;/**  * @ClassName: GpmsWebServiceService  * @Description: TODO(GPMS二维码接口)  *   */@WebService(serviceName="GpmsWebServiceService")public interface GpmsWebServiceService {public byte[] getLegContractQRCode(String contractId);}
impl:
@WebService(endpointInterface="com.haier.leg.contract.gpmscontract.service.GpmsWebServiceService",serviceName="GpmsWebServiceService")public class GpmsWebServiceImpl implements GpmsWebServiceService{}

使用wsimport命令生成webservice客户端:

wsimport -keep -p com.haier.leg.contract.gpmscontract.service http://localhost:8089/leg/ws/gpmsqr?wsdl


0 0
原创粉丝点击