Commit e66843cb authored by Quxl's avatar Quxl

x

parent 9fce53b5
package com.egolm.sso.clients;
import java.io.File;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.HashMap;
import java.util.Map;
......@@ -16,6 +18,7 @@ import org.apache.cxf.ws.security.wss4j.WSS4JOutInterceptor;
import org.apache.ws.security.handler.WSHandlerConstants;
import org.apache.wss4j.common.ext.WSPasswordCallback;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.system.ApplicationHome;
import org.springframework.stereotype.Component;
@Component
......@@ -39,6 +42,18 @@ public class SAPServiceFactory {
return service;
}
private static String absolutePath = null;
public URL getAbsoluteURL(String WSDLPATH) throws MalformedURLException {
if (absolutePath == null) {
ApplicationHome home = new ApplicationHome(getClass());
File jarFile = home.getSource();
File folder = jarFile.getParentFile();
absolutePath = folder.getAbsolutePath();
}
return new URL("file:///" + absolutePath + "/" + WSDLPATH);
}
private WSS4JOutInterceptor wss4JOutInterceptor = null;
public WSS4JOutInterceptor getWSS4JOutInterceptor() {
......
......@@ -2,7 +2,6 @@ package com.egolm.sso.clients.SI_004_INVENTORY_SyncOutService;
import java.math.BigInteger;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
......@@ -67,7 +66,7 @@ public class SI004INVENTORYSyncOutServiceTask {
}
public void runTask() throws MalformedURLException {
SI004INVENTORYSyncOut service = new SI004INVENTORYSyncOutService(new URL(WSDLPATH)).getPort(SI004INVENTORYSyncOut.class);
SI004INVENTORYSyncOut service = new SI004INVENTORYSyncOutService(factory.getAbsoluteURL(WSDLPATH)).getPort(SI004INVENTORYSyncOut.class);
ClientProxy.getClient(service).getOutInterceptors().add(factory.getWSS4JOutInterceptor());
this.sendData(service);
}
......
package com.egolm.sso.clients.SI_009_SO_CREATION_AsynOutService;
import java.net.MalformedURLException;
import java.net.URL;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
......@@ -66,7 +65,7 @@ public class SI009SOCREATIONAsynOutServiceTask {
}
public void runTask() throws MalformedURLException {
SI009SOCREATIONAsynOut service = new SI009SOCREATIONAsynOutService(new URL(WSDLPATH)).getPort(SI009SOCREATIONAsynOut.class);
SI009SOCREATIONAsynOut service = new SI009SOCREATIONAsynOutService(factory.getAbsoluteURL(WSDLPATH)).getPort(SI009SOCREATIONAsynOut.class);
ClientProxy.getClient(service).getOutInterceptors().add(factory.getWSS4JOutInterceptor());
this.sendData(service);
}
......
......@@ -2,7 +2,6 @@ package com.egolm.sso.clients.SI_011_ACTUAL_SALES_SyncOutService;
import java.math.BigInteger;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
......@@ -67,7 +66,7 @@ public class SI011ACTUALSALESSyncOutServiceTask {
}
public void runTask() throws MalformedURLException {
SI011ACTUALSALESSyncOut service = new SI011ACTUALSALESSyncOutService(new URL(WSDLPATH)).getPort(SI011ACTUALSALESSyncOut.class);
SI011ACTUALSALESSyncOut service = new SI011ACTUALSALESSyncOutService(factory.getAbsoluteURL(WSDLPATH)).getPort(SI011ACTUALSALESSyncOut.class);
ClientProxy.getClient(service).getOutInterceptors().add(factory.getWSS4JOutInterceptor());
this.sendData(service);
}
......
......@@ -6,9 +6,9 @@ CRON:
N004: 0 20 0 * * ?
N011: 0 30 0 * * ?
WSDL:
N009: file:WSDL/SI_009_SO_CREATION_AsynOutService.wsdl
N004: file:WSDL/SI_004_INVENTORY_SyncOutService.wsdl
N011: file:WSDL/SI_011_ACTUAL_SALES_SyncOutService.wsdl
N009: WSDL/SI_009_SO_CREATION_AsynOutService.wsdl
N004: WSDL/SI_004_INVENTORY_SyncOutService.wsdl
N011: WSDL/SI_011_ACTUAL_SALES_SyncOutService.wsdl
server:
port: 8080
spring:
......
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