CXFConfig.java
1.72 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
51
52
53
54
55
56
57
58
package com.bsth;
import com.bsth.ws_server.park_station.CompanyServiceSoap;
import com.bsth.ws_server.waybill.LD_ServiceSoap;
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.boot.web.servlet.ServletRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.Ordered;
import javax.xml.ws.Endpoint;
/**
* Created by panzhao on 2017/3/9.
*/
@Configuration
public class CXFConfig {
@Bean(name = Bus.DEFAULT_BUS_ID)
public SpringBus springBus() {
return new SpringBus();
}
public CompanyServiceSoap companyService(){
return new CompanyServiceSoap();
}
public LD_ServiceSoap ldServiceSoap(){
return new LD_ServiceSoap();
}
@Bean
public Endpoint companyEndpoint() {
EndpointImpl endpoint = new EndpointImpl(springBus(), companyService());
endpoint.publish("/CompanyService");
//endpoint.getInInterceptors().add(new AuthInterceptor());
return endpoint;
}
@Bean
public Endpoint ldServiceEndpoint() {
EndpointImpl endpoint = new EndpointImpl(springBus(), ldServiceSoap());
endpoint.publish("/LD_Service");
//endpoint.getInInterceptors().add(new AuthInterceptor());
return endpoint;
}
@Bean
public ServletRegistrationBean servletRegistrationBean() {
ServletRegistrationBean bean = new ServletRegistrationBean(new CXFServlet(), "/webservice/*");
bean.setLoadOnStartup(0);
bean.setOrder(Ordered.HIGHEST_PRECEDENCE);
return bean;
}
}