CxfConfig.java
1.39 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
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;
}
}