Webservice接口
This commit is contained in:
@@ -451,6 +451,33 @@
|
||||
<artifactId>lucene-queryparser</artifactId>
|
||||
<version>${lucene.version}</version>
|
||||
</dependency>
|
||||
<!-- webService-->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web-services</artifactId>
|
||||
</dependency>
|
||||
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.cxf</groupId>
|
||||
<artifactId>cxf-rt-frontend-jaxws</artifactId>
|
||||
<version>3.2.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.cxf</groupId>
|
||||
<artifactId>cxf-rt-transports-http</artifactId>
|
||||
<version>3.2.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.cxf</groupId>
|
||||
<artifactId>cxf-core</artifactId>
|
||||
<version>3.3.5</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.cxf</groupId>
|
||||
<artifactId>cxf-rt-transports-http</artifactId>
|
||||
<version>3.2.4</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
package org.nl.wms.mes.domain;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class Public {
|
||||
// 接口名称
|
||||
private String INTF_ID;
|
||||
// 源系统
|
||||
private String SRC_SYSTEM;
|
||||
// 目标系统
|
||||
private String DEST_SYSTEM;
|
||||
// 消息ID
|
||||
private String SRC_MSGID;
|
||||
// 控制预留1
|
||||
private String BACKUP1;
|
||||
// 控制预留2
|
||||
private String BACKUP2;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
package org.nl.wms.mes.domain;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.ToString;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
@Data
|
||||
@ToString
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@XmlRootElement
|
||||
@Accessors(chain = true)
|
||||
public class QPMES060Request extends Public {
|
||||
// 入库单号
|
||||
private String SimtOrderNo;
|
||||
// 场地
|
||||
private String locationCode;
|
||||
// 入库类型
|
||||
private String simtType;
|
||||
// 到货单号
|
||||
private String deliveryNo;
|
||||
// 扫描库位
|
||||
private String whlCode;
|
||||
// 托盘号
|
||||
private String PalletSN;
|
||||
// 物料条码号
|
||||
private String lotSN;
|
||||
// 物料编码
|
||||
private String productName;
|
||||
// 物料名称
|
||||
private String productDescription;
|
||||
// 供应商编码
|
||||
private String supplierCode;
|
||||
// 供应商名称
|
||||
private String supplierName;
|
||||
// 规格
|
||||
private String specification;
|
||||
// 批次号
|
||||
private String batch;
|
||||
// 数量
|
||||
private String qty;
|
||||
// 来料长度
|
||||
private String incomingLength;
|
||||
// 来料重量
|
||||
private String incomingWeight;
|
||||
// 来料缺陷长度
|
||||
private String incomingchipping;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package org.nl.wms.mes.domain;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class QPMES060Response extends Public {
|
||||
// 消息状态
|
||||
private String STATUS;
|
||||
// 消息文本
|
||||
private String MESSAGE;
|
||||
// 预留主键1
|
||||
private String KEY_VALUE01;
|
||||
// 预留主键2
|
||||
private String KEY_VALUE02;
|
||||
// 预留主键3
|
||||
private String KEY_VALUE03;
|
||||
// 预留主键4
|
||||
private String KEY_VALUE04;
|
||||
// 预留主键5
|
||||
private String KEY_VALUE05;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
package org.nl.wms.mes.webservice;
|
||||
|
||||
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.nl.wms.mes.webservice.service.QPMES060Service;
|
||||
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;
|
||||
|
||||
@Configuration
|
||||
public class WebServiceConfig {
|
||||
|
||||
@Autowired
|
||||
private QPMES060Service qpmes060Service;
|
||||
|
||||
// @Autowired
|
||||
// private WebServiceAuthInterceptor interceptor;
|
||||
|
||||
/**
|
||||
* Apache CXF 核心架构是以BUS为核心,整合其他组件。
|
||||
* Bus是CXF的主干, 为共享资源提供一个可配置的场所,作用类似于Spring的ApplicationContext,这些共享资源包括
|
||||
* WSDl管理器、绑定工厂等。通过对BUS进行扩展,可以方便地容纳自己的资源,或者替换现有的资源。默认Bus实现基于Spring架构,
|
||||
* 通过依赖注入,在运行时将组件串联起来。BusFactory负责Bus的创建。默认的BusFactory是SpringBusFactory,对应于默认
|
||||
* 的Bus实现。在构造过程中,SpringBusFactory会搜索META-INF/cxf(包含在 CXF 的jar中)下的所有bean配置文件。
|
||||
* 根据这些配置文件构建一个ApplicationContext。开发者也可以提供自己的配置文件来定制Bus。
|
||||
*/
|
||||
@Bean(name = Bus.DEFAULT_BUS_ID)
|
||||
public SpringBus springBus() {
|
||||
return new SpringBus();
|
||||
}
|
||||
|
||||
/**
|
||||
* http://localhost:8010/webServices?wsdl
|
||||
*/
|
||||
@Bean
|
||||
public ServletRegistrationBean getRegistrationBean() {
|
||||
return new ServletRegistrationBean(new CXFServlet(), "/webServices/*");
|
||||
}
|
||||
|
||||
/**
|
||||
* http://localhost:8010/webServices/qpmes060?wsdl
|
||||
*/
|
||||
@Bean
|
||||
public Endpoint messageEndPoint() {
|
||||
EndpointImpl endpoint = new EndpointImpl(springBus(), qpmes060Service);
|
||||
endpoint.publish("/qpmes060");
|
||||
// endpoint.getInInterceptors().add(this.interceptor);
|
||||
return endpoint;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package org.nl.wms.mes.webservice.service;
|
||||
|
||||
import org.nl.wms.mes.domain.QPMES060Request;
|
||||
import org.nl.wms.mes.domain.QPMES060Response;
|
||||
|
||||
import javax.jws.WebMethod;
|
||||
import javax.jws.WebParam;
|
||||
import javax.jws.WebService;
|
||||
import java.util.List;
|
||||
|
||||
@WebService(
|
||||
name = "QPMES060", // 暴露服务名称
|
||||
targetNamespace = "http://127.0.0.1:8010"// 命名空间,一般是接口的包名倒序
|
||||
)
|
||||
public interface QPMES060Service {
|
||||
|
||||
@WebMethod(operationName = "notice")
|
||||
public QPMES060Request QPMES060(@WebParam(name = "notice") QPMES060Response notice);
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package org.nl.wms.mes.webservice.service.impl;
|
||||
|
||||
import org.nl.wms.mes.domain.QPMES060Request;
|
||||
import org.nl.wms.mes.domain.QPMES060Response;
|
||||
import org.nl.wms.mes.webservice.service.QPMES060Service;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.jws.WebService;
|
||||
|
||||
@Component
|
||||
@WebService(
|
||||
name = "QPMES060", // 暴露服务名称
|
||||
targetNamespace = "http://127.0.0.1:8010", // 命名空间,一般是接口的包名倒序
|
||||
endpointInterface = "org.nl.wms.mes.webservice.service.QPMES060Service" // 接口类全路径
|
||||
)
|
||||
public class QPMES060ServiceImpl implements QPMES060Service {
|
||||
|
||||
@Override
|
||||
public QPMES060Request QPMES060(QPMES060Response notice){
|
||||
|
||||
System.out.println("服务被调用 参数:" + notice.toString());
|
||||
return new QPMES060Request();
|
||||
}
|
||||
}
|
||||
@@ -160,4 +160,4 @@ sa-token:
|
||||
# Redis服务器连接密码(默认为空)
|
||||
password:
|
||||
# 连接超时时间
|
||||
timeout: 10s
|
||||
timeout: 10s
|
||||
Reference in New Issue
Block a user