Commit b42b58c7 authored by Quxl's avatar Quxl

x

parent 3bb9ec91
......@@ -42,20 +42,24 @@ public class SAPServiceFactory {
@Value("${schneider.password}")
private String password;
@Value("${CLIENT_KEYSTORE.FILEPATH}")
@Value("${CLIENT.KEYSTORE.FILEPATH}")
private String keyStoreFile;
@Value("${CLIENT_KEYSTORE.PASSWORD}")
@Value("${CLIENT.KEYSTORE.PASSWORD}")
private String keyStorePassword;
public <T> T create(Class<T> requiredType, URL wsdlLocation, QName serviceQName) {
@Value("${CLIENT.SSL}")
private boolean isOpenSSL;
public <T> T create(Class<T> requiredType, URL wsdlLocation, QName serviceQName, QName portQName) {
assert requiredType != null : "WebService requiredType cannot be null";
assert wsdlLocation != null : "WebService wsdlLocation cannot be null";
assert serviceQName != null : "WebService serviceQName cannot be null";
Service dyService = Service.create(wsdlLocation, serviceQName);
T service = dyService.getPort(requiredType);
T service = portQName == null ? dyService.getPort(requiredType) : dyService.getPort(portQName, requiredType);
Client client = ClientProxy.getClient(service);
client.getOutInterceptors().add(this.getWSS4JOutInterceptor());
if(isOpenSSL) {
HTTPConduit httpConduit = (HTTPConduit) client.getConduit();
TLSClientParameters tlsParams = httpConduit.getTlsClientParameters();
tlsParams = tlsParams == null ? new TLSClientParameters() : tlsParams;
......@@ -63,6 +67,7 @@ public class SAPServiceFactory {
tlsParams.setKeyManagers(getKeyManagers());
tlsParams.setTrustManagers(getTrustManagers());
httpConduit.setTlsClientParameters(tlsParams);
}
return service;
}
......
......@@ -56,6 +56,9 @@ public class SI004INVENTORYSyncOutServiceTask {
@Value("${WSDL.N004}")
private String WSDLPATH;
@Value("${CLIENT.SSL}")
private boolean isOpenSSL;
@Autowired
private SAPServiceFactory factory;
......@@ -65,7 +68,7 @@ public class SI004INVENTORYSyncOutServiceTask {
}
public void runTask() throws MalformedURLException {
SI004INVENTORYSyncOut service = factory.create(SI004INVENTORYSyncOut.class, factory.getAbsoluteURL(WSDLPATH), SI004INVENTORYSyncOutService.SERVICE);
SI004INVENTORYSyncOut service = factory.create(SI004INVENTORYSyncOut.class, factory.getAbsoluteURL(WSDLPATH), SI004INVENTORYSyncOutService.SERVICE, isOpenSSL ? SI004INVENTORYSyncOutService.HTTPSPort : SI004INVENTORYSyncOutService.HTTPPort);
this.sendData(service);
}
......
......@@ -55,6 +55,9 @@ public class SI009SOCREATIONAsynOutServiceTask {
@Value("${xmlRoot}")
private String xmlRoot;
@Value("${CLIENT.SSL}")
private boolean isOpenSSL;
@Autowired
private SAPServiceFactory factory;
......@@ -64,7 +67,7 @@ public class SI009SOCREATIONAsynOutServiceTask {
}
public void runTask() throws MalformedURLException {
SI009SOCREATIONAsynOut service = factory.create(SI009SOCREATIONAsynOut.class, factory.getAbsoluteURL(WSDLPATH), SI009SOCREATIONAsynOutService.SERVICE);
SI009SOCREATIONAsynOut service = factory.create(SI009SOCREATIONAsynOut.class, factory.getAbsoluteURL(WSDLPATH), SI009SOCREATIONAsynOutService.SERVICE, isOpenSSL ? SI009SOCREATIONAsynOutService.HTTPSPort : SI009SOCREATIONAsynOutService.HTTPPort);
this.sendData(service);
}
......
......@@ -56,6 +56,9 @@ public class SI011ACTUALSALESSyncOutServiceTask {
@Value("${xmlRoot}")
private String xmlRoot;
@Value("${CLIENT.SSL}")
private boolean isOpenSSL;
@Autowired
private SAPServiceFactory factory;
......@@ -65,7 +68,7 @@ public class SI011ACTUALSALESSyncOutServiceTask {
}
public void runTask() throws MalformedURLException {
SI011ACTUALSALESSyncOut service = factory.create(SI011ACTUALSALESSyncOut.class, factory.getAbsoluteURL(WSDLPATH), SI011ACTUALSALESSyncOutService.SERVICE);
SI011ACTUALSALESSyncOut service = factory.create(SI011ACTUALSALESSyncOut.class, factory.getAbsoluteURL(WSDLPATH), SI011ACTUALSALESSyncOutService.SERVICE, isOpenSSL ? SI011ACTUALSALESSyncOutService.HTTPSPort : SI011ACTUALSALESSyncOutService.HTTPPort);
this.sendData(service);
}
......
CLIENT_KEYSTORE:
CLIENT:
SSL: true
KEYSTORE:
FILEPATH: SSL/sap.keystore
PASSWORD: 123456
isUsedTestController: true
xmlRoot: xml
systemId: system
CRON:
N009: 0 10 0 * * ?
N004: 0 20 0 * * ?
......@@ -12,6 +11,9 @@ WSDL:
N009: WSDL/SI_009_SO_CREATION_AsynOutService.wsdl
N004: WSDL/SI_004_INVENTORY_SyncOutService.wsdl
N011: WSDL/SI_011_ACTUAL_SALES_SyncOutService.wsdl
isUsedTestController: true
xmlRoot: xml
systemId: system
server:
port: 8080
tomcat:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment