SmdService.java
3.2 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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
package StSys.RoyoTech;
import com.myproject.util.DateUtil;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.jws.WebMethod;
import javax.jws.WebParam;
import javax.jws.WebResult;
import javax.jws.WebService;
import javax.xml.ws.Endpoint;
import java.util.Date;
/**
* Created by sunke on 2019/10/22.
*/
@WebService(name = "IWSInterface", targetNamespace = "RoyoTech.StSys")
@Service
public class SmdService {
protected final transient Logger log = LogManager.getLogger(getClass());
@Autowired
private ServiceHandle serviceHandle;
@WebMethod(operationName = "WebServiceIsConnected", action = "RoyoTech.StSys/IWSInterface/WebServiceIsConnected")
@WebResult(name = "WebServiceIsConnectedResult", targetNamespace = "RoyoTech.StSys")
//@RequestWrapper(localName = "WebServiceIsConnected", targetNamespace = "RoyoTech.StSys", className = "example.client.WebServiceIsConnected")
//@ResponseWrapper(localName = "WebServiceIsConnectedResponse", targetNamespace = "RoyoTech.StSys", className = "example.client.WebServiceIsConnectedResponse")
public Boolean WebServiceIsConnected() {
//log.info("WebServiceIsConnected");
return true;
}
@WebMethod(operationName = "XmlAction", action = "RoyoTech.StSys/IWSInterface/XmlAction")
@WebResult(name = "XmlActionResult", targetNamespace = "RoyoTech.StSys")
//@RequestWrapper(localName = "XmlAction", targetNamespace = "RoyoTech.StSys", className = "example.client.XmlAction")
//@ResponseWrapper(localName = "XmlActionResponse", targetNamespace = "RoyoTech.StSys", className = "example.client.XmlActionResponse")
//@Action(input = "RoyoTech.StSys/IWSInterface/XmlAction", output = "RoyoTech.StSys/IWSInterface/XmlActionResponse")
public XmlResultWrapper XmlAction(@WebParam(name = "xmlData", targetNamespace = "RoyoTech.StSys")
String xmlData) {
log.info("receive service cmd:" + xmlData);
if(xmlData == null){
xmlData = "";
}
XmlResultWrapper wrapper = new XmlResultWrapper();
if(serviceHandle != null){
wrapper.XmlResult = serviceHandle.handleCommand(xmlData);
}
return wrapper;
}
public static void main(String[] argv) {
SmdService service = new SmdService();
ServiceHandle handle = new ServiceHandle();
service.serviceHandle = handle;
String address = "http://10.42.73.173:8080/services/SmdService";
address = "http://0.0.0.0:8888/services/SmdService";
System.out.println("Publish the webservice, address:" + address);
Endpoint.publish(address, service);
// String posName = "3_2_1";
// String cid = "06001";
// String[] infos = posName.split("_");
// if(infos.length >= 3){
// String last = infos[infos.length-1];
// String middle = infos[infos.length -2];
// String first = infos[infos.length - 3];
// String Depot = "T" + cid + "." + first + middle + last;
// System.out.println(Depot);
// }
}
}