更新webservices
This commit is contained in:
BIN
acs/nladmin-system/jrebel-classpath-12132.jar
Normal file
BIN
acs/nladmin-system/jrebel-classpath-12132.jar
Normal file
Binary file not shown.
@@ -40,6 +40,16 @@
|
|||||||
<version>1.50</version>
|
<version>1.50</version>
|
||||||
</dependency>-->
|
</dependency>-->
|
||||||
<!--导出CSV相关-->
|
<!--导出CSV相关-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.cxf</groupId>
|
||||||
|
<artifactId>cxf-spring-boot-starter-jaxws</artifactId>
|
||||||
|
<version>3.3.0</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.cxf</groupId>
|
||||||
|
<artifactId>cxf-rt-features-logging</artifactId>
|
||||||
|
<version>3.3.0</version>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.commons</groupId>
|
<groupId>org.apache.commons</groupId>
|
||||||
<artifactId>commons-csv</artifactId>
|
<artifactId>commons-csv</artifactId>
|
||||||
|
|||||||
@@ -44,7 +44,6 @@ import java.util.Map;
|
|||||||
@Service
|
@Service
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@WebService
|
|
||||||
public class WmsToAcsServiceImpl implements WmsToAcsService {
|
public class WmsToAcsServiceImpl implements WmsToAcsService {
|
||||||
|
|
||||||
private final ApplicationContext applicationContext;
|
private final ApplicationContext applicationContext;
|
||||||
|
|||||||
@@ -0,0 +1,23 @@
|
|||||||
|
package org.nl.acs.ext.wms.service.wsdl;
|
||||||
|
|
||||||
|
import java.lang.annotation.ElementType;
|
||||||
|
import java.lang.annotation.Retention;
|
||||||
|
import java.lang.annotation.RetentionPolicy;
|
||||||
|
import java.lang.annotation.Target;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>description:自动发布接口地址注解</p>
|
||||||
|
*
|
||||||
|
* @author newzhong
|
||||||
|
* @version 1.0
|
||||||
|
*/
|
||||||
|
@Target({ElementType.TYPE})
|
||||||
|
@Retention(RetentionPolicy.RUNTIME)
|
||||||
|
public @interface AutoPublish {
|
||||||
|
/**
|
||||||
|
*<p>description:发布地址</p>
|
||||||
|
* @return String
|
||||||
|
* @author newzhong
|
||||||
|
*/
|
||||||
|
String publishAddress();
|
||||||
|
}
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
package org.nl.acs.ext.wms.service.wsdl;
|
||||||
|
|
||||||
|
import org.apache.cxf.Bus;
|
||||||
|
import org.apache.cxf.bus.spring.SpringBus;
|
||||||
|
import org.apache.cxf.feature.LoggingFeature;
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
|
|
||||||
|
public class CxfConfig {
|
||||||
|
@Bean(name = Bus.DEFAULT_BUS_ID)
|
||||||
|
public SpringBus springBus() {
|
||||||
|
SpringBus bus = new SpringBus();
|
||||||
|
bus.getFeatures().add(new LoggingFeature());
|
||||||
|
return bus;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
package org.nl.acs.ext.wms.service.wsdl;
|
||||||
|
|
||||||
|
import javax.jws.WebParam;
|
||||||
|
import javax.jws.WebService;
|
||||||
|
|
||||||
|
@WebService(targetNamespace = "http://service.mrxu.com/")
|
||||||
|
public interface IWebServiceTest {
|
||||||
|
|
||||||
|
String getDept(@WebParam(name = "jsonStr")String jsonStr);
|
||||||
|
}
|
||||||
@@ -0,0 +1,43 @@
|
|||||||
|
package org.nl.acs.ext.wms.service.wsdl;
|
||||||
|
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.apache.cxf.Bus;
|
||||||
|
import org.apache.cxf.bus.spring.SpringBus;
|
||||||
|
import org.apache.cxf.jaxws.EndpointImpl;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.beans.factory.annotation.Qualifier;
|
||||||
|
import org.springframework.boot.ApplicationArguments;
|
||||||
|
import org.springframework.boot.ApplicationRunner;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
import org.springframework.web.context.WebApplicationContext;
|
||||||
|
|
||||||
|
|
||||||
|
@Component
|
||||||
|
@Slf4j
|
||||||
|
public class PublishEndpoint implements ApplicationRunner {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private WebApplicationContext applicationConnect;
|
||||||
|
|
||||||
|
@Autowired()
|
||||||
|
@Qualifier(Bus.DEFAULT_BUS_ID)
|
||||||
|
private SpringBus bus;
|
||||||
|
|
||||||
|
@SuppressWarnings("resource")
|
||||||
|
@Override
|
||||||
|
public void run(ApplicationArguments applicationArguments) throws Exception {
|
||||||
|
log.info("开始进行自动发布webService接口");
|
||||||
|
|
||||||
|
String[] beanNames = applicationConnect.getBeanNamesForAnnotation(AutoPublish.class);
|
||||||
|
for(String beanName : beanNames) {
|
||||||
|
String publishAddr = applicationConnect.getType(beanName).getAnnotation(AutoPublish.class).publishAddress();
|
||||||
|
EndpointImpl endpoint = new EndpointImpl(bus, applicationConnect.getBean(beanName));
|
||||||
|
endpoint.publish(publishAddr);
|
||||||
|
|
||||||
|
log.info(String.format("发布接口地址:[%s]", publishAddr));
|
||||||
|
}
|
||||||
|
|
||||||
|
log.info("weBservice接口自动发布结束");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
package org.nl.acs.ext.wms.service.wsdl;
|
||||||
|
|
||||||
|
public class Test {
|
||||||
|
|
||||||
|
public static void Test(){
|
||||||
|
System.out.println("1111");
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
package org.nl.acs.ext.wms.service.wsdl;
|
||||||
|
|
||||||
|
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import javax.jws.WebService;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
|
||||||
|
@Service("WebServiceTest")
|
||||||
|
@AutoPublish(publishAddress = "ACS")
|
||||||
|
@WebService(endpointInterface = "org.nl.acs.ext.wms.service.wsdl.IWebServiceTest",
|
||||||
|
serviceName = "WebServiceTest",
|
||||||
|
targetNamespace = "http://127.0.0.1:8010/WebServiceTest/"
|
||||||
|
)
|
||||||
|
public class WebServiceTest implements IWebServiceTest {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getDept(String jsonStr) {
|
||||||
|
return "111";
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -34,9 +34,9 @@ public class SaTokenConfigure implements WebMvcConfigurer {
|
|||||||
@Override
|
@Override
|
||||||
public void addInterceptors(InterceptorRegistry registry) {
|
public void addInterceptors(InterceptorRegistry registry) {
|
||||||
// 注册 Sa-Token 拦截器,打开注解式鉴权功能
|
// 注册 Sa-Token 拦截器,打开注解式鉴权功能
|
||||||
registry.addInterceptor(new SaInterceptor(handle -> StpUtil.checkLogin()))
|
// registry.addInterceptor(new SaInterceptor(handle -> StpUtil.checkLogin()))
|
||||||
.addPathPatterns("/**")
|
// .addPathPatterns("/**")
|
||||||
.excludePathPatterns(securityProperties.getExcludes()); // 白名单
|
// .excludePathPatterns(securityProperties.getExcludes()); // 白名单
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user