Browse Source

Webservice接口

master
psh 11 months ago
parent
commit
51feab2d25
  1. 27
      lms/nladmin-system/nlsso-server/pom.xml
  2. 20
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/mes/domain/Public.java
  3. 55
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/mes/domain/QPMES060Request.java
  4. 22
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/mes/domain/QPMES060Response.java
  5. 56
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/mes/webservice/WebServiceConfig.java
  6. 19
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/mes/webservice/service/QPMES060Service.java
  7. 24
      lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/mes/webservice/service/impl/QPMES060ServiceImpl.java
  8. 2
      lms/nladmin-system/nlsso-server/src/main/resources/config/application-dev.yml

27
lms/nladmin-system/nlsso-server/pom.xml

@ -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>

20
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/mes/domain/Public.java

@ -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;
}

55
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/mes/domain/QPMES060Request.java

@ -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;
}

22
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/mes/domain/QPMES060Response.java

@ -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;
}

56
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/mes/webservice/WebServiceConfig.java

@ -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;
}
}

19
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/mes/webservice/service/QPMES060Service.java

@ -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);
}

24
lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/mes/webservice/service/impl/QPMES060ServiceImpl.java

@ -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();
}
}

2
lms/nladmin-system/nlsso-server/src/main/resources/config/application-dev.yml

@ -160,4 +160,4 @@ sa-token:
# Redis服务器连接密码(默认为空)
password:
# 连接超时时间
timeout: 10s
timeout: 10s
Loading…
Cancel
Save