lizw преди 2 години
родител
ревизия
fe22f02390

+ 18 - 0
soap-gateway/src/test/java/com/galaxis/soap/utils/CommService.java

@@ -0,0 +1,18 @@
+package com.galaxis.soap.utils;
+
+import javax.jws.WebMethod;
+import javax.jws.WebParam;
+import javax.jws.WebService;
+
+/**
+ * 作者:lizw <br/>
+ * 创建时间:2022/11/02 17:08 <br/>
+ */
+@WebService(targetNamespace = "http://www.wms.com", name = "ERP_COMM_SERVICE")
+public interface CommService {
+    /**
+     * 入口服务
+     */
+    @WebMethod(action = "webServiceMain")
+    String webServiceMain(@WebParam String serviceName, @WebParam String functionName, @WebParam String data);
+}

+ 35 - 0
soap-gateway/src/test/java/com/galaxis/soap/utils/CommServiceTest.java

@@ -0,0 +1,35 @@
+package com.galaxis.soap.utils;
+
+import lombok.SneakyThrows;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.io.FileUtils;
+import org.junit.jupiter.api.Test;
+
+import javax.xml.namespace.QName;
+import javax.xml.ws.Service;
+import java.io.File;
+import java.net.URL;
+import java.nio.charset.StandardCharsets;
+
+/**
+ * 作者:lizw <br/>
+ * 创建时间:2022/11/02 17:10 <br/>
+ */
+@Slf4j
+public class CommServiceTest {
+    @SneakyThrows
+    @Test
+    public void t01() {
+        String data = FileUtils.readFileToString(new File("./src/test/resources/tmp.json"), StandardCharsets.UTF_8);
+        QName qName = new QName("http://www.wms.com", "ERP_COMM_SERVICE");
+        Service service = Service.create(new URL("http://122.9.140.63:8111/biz/JNDWebService?wsdl"), qName);
+        CommService commService = service.getPort(CommService.class);
+        String res = commService.webServiceMain("ERP_BAS_SKU_SERVICE", "skuInsertOrUpdate", data);
+        log.info("---> {}", res);
+    }
+}
+
+
+//        Service service = Service.create(new URL("http://122.9.140.63:8094/biz/JNDWebService?wsdl"), qName);
+//        URL url = new File("./src/test/resources/tmp.xml").toURI().toURL();
+//        Service service = Service.create(url, qName);

+ 92 - 0
soap-gateway/src/test/resources/tmp.json

@@ -0,0 +1,92 @@
+{
+  "requestId": "49f41b51348049bf95e9d41271ff08f5",
+  "requestTime": "2022-11-02 11:00:00",
+  "data": [
+    {
+      "ownerId": "1000",
+      "whId": "1000000002",
+      "skuId": "DEL00022132",
+      "skuCode": "990171",
+      "skuName": "长粒香大米",
+      "logogram": "ZLXDM",
+      "skuDesc": "5kg/袋",
+      "manufacturer": "山东鲁抗医药股份有限公司",
+      "origin": "山东鲁抗医药股份有限公司",
+      "isEnable": 1,
+      "stockEnv": 1,
+      "length": 0.00,
+      "width": 0.00,
+      "high": 0.00,
+      "volume": 0.00,
+      "grossWeight": 0.00,
+      "netWeight": 0.00,
+      "tareWeight": 0.00,
+      "price": 0.0000,
+      "skuClassify": 1,
+      "skuCategory": 1,
+      "remark": "",
+      "packId": "1",
+      "allowOpenpack": 0,
+      "allowOpenbox": 0,
+      "barcode1": "",
+      "barcode2": "",
+      "barcode3": "",
+      "zt": 0,
+      "createBy": "高显葵",
+      "createAt": "2019-01-02",
+      "updateBy": "高显葵",
+      "updateAt": "2022-10-24 12:00:10",
+      "categories": 0,
+      "approvalNo": "",
+      "isRefrigerate": 0,
+      "isSpecialDrug": 0,
+      "isDoubleReview": 0,
+      "isKeyMaintain": 0,
+      "packMeas": 0,
+      "item_category": 1
+    },
+    {
+      "ownerId": "1000",
+      "whId": "1000000002",
+      "skuId": "SPZ00000001",
+      "skuCode": "010711000015",
+      "skuName": "阿昔洛韦乳膏",
+      "logogram": "AXLWRG",
+      "skuDesc": "10g/支",
+      "manufacturer": "福建太平洋制药有限公司",
+      "origin": "福建太平洋制药有限公司",
+      "isEnable": 1,
+      "stockEnv": 2,
+      "length": 0.00,
+      "width": 0.00,
+      "high": 0.00,
+      "volume": 0.00,
+      "grossWeight": 0.00,
+      "netWeight": 0.00,
+      "tareWeight": 0.00,
+      "price": 0.0000,
+      "skuClassify": 1,
+      "skuCategory": 1,
+      "remark": "",
+      "packId": "1",
+      "allowOpenpack": 0,
+      "allowOpenbox": 0,
+      "barcode1": "6922097700479",
+      "barcode2": "",
+      "barcode3": "",
+      "zt": 0,
+      "createBy": "邵胜岚",
+      "createAt": "2010-05-27",
+      "updateBy": "邵胜岚",
+      "updateAt": "2022-10-15 20:00:34",
+      "categories": 0,
+      "approvalNo": "国药准字H20063676",
+      "isRefrigerate": 0,
+      "isSpecialDrug": 0,
+      "isDoubleReview": 0,
+      "isKeyMaintain": 0,
+      "packMeas": 0,
+      "item_category": 3
+    }
+  ]
+}

+ 63 - 0
soap-gateway/src/test/resources/tmp.xml

@@ -0,0 +1,63 @@
+<wsdl:definitions xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:tns="http://www.wms.com" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:ns1="http://schemas.xmlsoap.org/soap/http" name="ERP_COMM_SERVICE" targetNamespace="http://www.wms.com">
+    <wsdl:types>
+        <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://www.wms.com" attributeFormDefault="unqualified" elementFormDefault="unqualified" targetNamespace="http://www.wms.com">
+            <xs:element name="webServiceMain" type="tns:webServiceMain"/>
+            <xs:element name="webServiceMainResponse" type="tns:webServiceMainResponse"/>
+            <xs:complexType name="webServiceMain">
+                <xs:sequence>
+                    <xs:element minOccurs="0" name="arg0" type="xs:string"/>
+                    <xs:element minOccurs="0" name="arg1" type="xs:string"/>
+                    <xs:element minOccurs="0" name="arg2" type="xs:string"/>
+                </xs:sequence>
+            </xs:complexType>
+            <xs:complexType name="webServiceMainResponse">
+                <xs:sequence>
+                    <xs:element minOccurs="0" name="return" type="xs:string"/>
+                </xs:sequence>
+            </xs:complexType>
+            <xs:element name="BusinessException" type="tns:BusinessException"/>
+            <xs:complexType name="BusinessException">
+                <xs:sequence>
+                    <xs:element minOccurs="0" name="status" type="xs:int"/>
+                    <xs:element minOccurs="0" name="message" type="xs:string"/>
+                </xs:sequence>
+            </xs:complexType>
+        </xs:schema>
+    </wsdl:types>
+    <wsdl:message name="BusinessException">
+        <wsdl:part element="tns:BusinessException" name="BusinessException"> </wsdl:part>
+    </wsdl:message>
+    <wsdl:message name="webServiceMain">
+        <wsdl:part element="tns:webServiceMain" name="parameters"> </wsdl:part>
+    </wsdl:message>
+    <wsdl:message name="webServiceMainResponse">
+        <wsdl:part element="tns:webServiceMainResponse" name="parameters"> </wsdl:part>
+    </wsdl:message>
+    <wsdl:portType name="ERP_COMM_SERVICE">
+        <wsdl:operation name="webServiceMain">
+            <wsdl:input message="tns:webServiceMain" name="webServiceMain"> </wsdl:input>
+            <wsdl:output message="tns:webServiceMainResponse" name="webServiceMainResponse"> </wsdl:output>
+            <wsdl:fault message="tns:BusinessException" name="BusinessException"> </wsdl:fault>
+        </wsdl:operation>
+    </wsdl:portType>
+    <wsdl:binding name="ERP_COMM_SERVICESoapBinding" type="tns:ERP_COMM_SERVICE">
+        <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
+        <wsdl:operation name="webServiceMain">
+            <soap:operation soapAction="webServiceMain" style="document"/>
+            <wsdl:input name="webServiceMain">
+                <soap:body use="literal"/>
+            </wsdl:input>
+            <wsdl:output name="webServiceMainResponse">
+                <soap:body use="literal"/>
+            </wsdl:output>
+            <wsdl:fault name="BusinessException">
+                <soap:fault name="BusinessException" use="literal"/>
+            </wsdl:fault>
+        </wsdl:operation>
+    </wsdl:binding>
+    <wsdl:service name="ERP_COMM_SERVICE">
+        <wsdl:port binding="tns:ERP_COMM_SERVICESoapBinding" name="CommServiceImplPort">
+            <soap:address location="http://122.9.140.63:8111/biz/JNDWebService"/>
+        </wsdl:port>
+    </wsdl:service>
+</wsdl:definitions>

+ 9 - 0
soap-gateway/src/test/resources/tmpa.xml

@@ -0,0 +1,9 @@
+<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
+    <soap:Body>
+        <ns2:webServiceMainResponse xmlns:ns2="http://www.wms.com">
+            <return>
+                {"code":200,"msg":"数据下传结果:{数据下传成功:物流中心编码=1000000002,公司代码=1000,商品ID=DEL00022132,商品编码=DEL00022132},{数据下传成功:物流中心编码=1000000002,公司代码=1000,商品ID=SPZ00000001,商品编码=SPZ00000001},","requestId":"520568bfad694cbfbd79fcc34af567b8","data":"null"}
+            </return>
+        </ns2:webServiceMainResponse>
+    </soap:Body>
+</soap:Envelope>