CxfConfig.java 1.39 KB
package com.huaheng.framework.config;

//import com.huaheng.api.erp.server.*;
import com.huaheng.api.csc.WmsWebService;
import com.huaheng.api.csc.domain.ProcessResult;
import org.apache.cxf.Bus;
import org.apache.cxf.bus.spring.SpringBus;
import org.apache.cxf.jaxws.EndpointImpl;
import org.apache.cxf.transport.servlet.CXFServlet;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.web.servlet.ServletRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import javax.xml.ws.Endpoint;


/**
 * @ClassName CxfConfig
 * @Description TODO
 * @Author Administrator
 * @Date 2020/10/1214:11
 */
@Configuration
public class CxfConfig {

    @Autowired
    private WmsWebService wmsWebService;

    @Autowired
    private Bus bus;

    /**
     * 发布服务
     * @return
     */
    @Bean
    public Endpoint userServiceEndpoint() {
        System.out.println("服务发布");
        //这里指定的端口不能跟应用的端口冲突, 单独指定
        String path = "http://127.0.0.1:8889/wms/webservice/";

        EndpointImpl userEndpoint = new EndpointImpl(bus, wmsWebService);
        userEndpoint.publish(path);

        System.out.println("服务成功,path: " + path);
        System.out.println(String.format("在线的wsdl:%s?wsdl", path));
        return userEndpoint;
    }
}