Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
S
sap-service
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
曲欣亮
sap-service
Commits
117c4d3a
Commit
117c4d3a
authored
Aug 13, 2019
by
Quxl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
x
parent
236739a0
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
32 additions
and
13 deletions
+32
-13
SI004INVENTORYSyncOutServiceTask.java
...TORY_SyncOutService/SI004INVENTORYSyncOutServiceTask.java
+4
-2
SI011ACTUALSALESSyncOutServiceTask.java
...ES_SyncOutService/SI011ACTUALSALESSyncOutServiceTask.java
+4
-2
ServiceFactory.java
src/main/java/com/egolm/sso/clients/ServiceFactory.java
+19
-6
ZMISD009SOCREATIONServiceTask.java
..._MI_SD_009_SO_CREATION/ZMISD009SOCREATIONServiceTask.java
+5
-3
No files found.
src/main/java/com/egolm/sso/clients/SI_004_INVENTORY_SyncOutService/SI004INVENTORYSyncOutServiceTask.java
View file @
117c4d3a
...
...
@@ -19,7 +19,6 @@ import org.springframework.stereotype.Component;
import
com.alibaba.fastjson.JSONObject
;
import
com.egolm.sso.clients.ServiceFactory
;
import
com.egolm.sso.clients.ServiceFactory.PasswordType
;
import
com.egolm.sso.config.XRException
;
import
com.egolm.sso.services.CommonService
;
import
com.egolm.sso.services.TraceService
;
...
...
@@ -59,6 +58,9 @@ public class SI004INVENTORYSyncOutServiceTask {
@Value
(
"${xmlRoot}"
)
private
String
xmlRoot
;
@Autowired
private
ServiceFactory
factory
;
@Scheduled
(
cron
=
"${cronSi004}"
)
public
void
execute
()
throws
MalformedURLException
{
this
.
runTask
();
...
...
@@ -70,7 +72,7 @@ public class SI004INVENTORYSyncOutServiceTask {
File
folder
=
jarFile
.
getParentFile
();
String
absolutePath
=
folder
.
getAbsolutePath
();
String
wsdlLocation
=
"file:///"
+
absolutePath
+
"/"
+
WSDLPATH
+
"/SI_004_INVENTORY_SyncOutService.wsdl"
;
SI004INVENTORYSyncOut
service
=
ServiceFactory
.
create
(
SI004INVENTORYSyncOut
.
class
,
wsdlLocation
,
SI004INVENTORYSyncOutService
.
SERVICE
,
SI004INVENTORYSyncOutService
.
HTTPPort
,
username
,
password
,
PasswordType
.
PasswordTex
t
);
SI004INVENTORYSyncOut
service
=
factory
.
create
(
SI004INVENTORYSyncOut
.
class
,
wsdlLocation
,
SI004INVENTORYSyncOutService
.
SERVICE
,
SI004INVENTORYSyncOutService
.
HTTPPor
t
);
this
.
sendData
(
service
);
}
...
...
src/main/java/com/egolm/sso/clients/SI_011_ACTUAL_SALES_SyncOutService/SI011ACTUALSALESSyncOutServiceTask.java
View file @
117c4d3a
...
...
@@ -18,7 +18,6 @@ import org.springframework.stereotype.Component;
import
com.alibaba.fastjson.JSONObject
;
import
com.egolm.sso.clients.ServiceFactory
;
import
com.egolm.sso.clients.ServiceFactory.PasswordType
;
import
com.egolm.sso.config.XRException
;
import
com.egolm.sso.services.CommonService
;
import
com.egolm.sso.services.TraceService
;
...
...
@@ -58,6 +57,9 @@ public class SI011ACTUALSALESSyncOutServiceTask {
@Value
(
"${xmlRoot}"
)
private
String
xmlRoot
;
@Autowired
private
ServiceFactory
factory
;
@Scheduled
(
cron
=
"${cronSi011}"
)
public
void
execute
()
{
this
.
runTask
();
...
...
@@ -69,7 +71,7 @@ public class SI011ACTUALSALESSyncOutServiceTask {
File
folder
=
jarFile
.
getParentFile
();
String
absolutePath
=
folder
.
getAbsolutePath
();
String
wsdlLocation
=
"file:///"
+
absolutePath
+
"/"
+
WSDLPATH
+
"/SI_011_ACTUAL_SALES_SyncOutService.wsdl"
;
SI011ACTUALSALESSyncOut
service
=
ServiceFactory
.
create
(
SI011ACTUALSALESSyncOut
.
class
,
wsdlLocation
,
SI011ACTUALSALESSyncOutService
.
SERVICE
,
SI011ACTUALSALESSyncOutService
.
HTTPPort
,
username
,
password
,
PasswordType
.
PasswordTex
t
);
SI011ACTUALSALESSyncOut
service
=
factory
.
create
(
SI011ACTUALSALESSyncOut
.
class
,
wsdlLocation
,
SI011ACTUALSALESSyncOutService
.
SERVICE
,
SI011ACTUALSALESSyncOutService
.
HTTPPor
t
);
this
.
sendData
(
service
);
}
...
...
src/main/java/com/egolm/sso/clients/ServiceFactory.java
View file @
117c4d3a
...
...
@@ -14,33 +14,46 @@ import org.apache.cxf.frontend.ClientProxy;
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.stereotype.Component
;
import
com.egolm.sso.config.XRException
;
@Component
public
class
ServiceFactory
{
public
static
<
T
>
T
create
(
Class
<
T
>
requiredType
,
String
wsdlLocation
,
QName
serviceQName
,
QName
portQName
,
String
username
,
String
password
,
PasswordType
passwordType
)
{
@Value
(
"${schneider.username}"
)
private
String
username
;
@Value
(
"${schneider.password}"
)
private
String
password
;
public
<
T
>
T
create
(
Class
<
T
>
requiredType
,
String
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"
;
try
{
URL
WSDL_URL
=
new
URL
(
wsdlLocation
);
Service
dyService
=
Service
.
create
(
WSDL_URL
,
serviceQName
);
T
service
=
dyService
.
getPort
(
portQName
,
requiredType
);
ClientProxy
.
getClient
(
service
).
getOutInterceptors
().
add
(
getWSS4JOutInterceptor
(
username
,
password
,
passwordType
));
T
service
=
portQName
==
null
?
dyService
.
getPort
(
requiredType
)
:
dyService
.
getPort
(
portQName
,
requiredType
);
ClientProxy
.
getClient
(
service
).
getOutInterceptors
().
add
(
getWSS4JOutInterceptor
());
return
service
;
}
catch
(
MalformedURLException
e
)
{
throw
new
XRException
(
e
);
}
}
private
static
WSS4JOutInterceptor
wss4JOutInterceptor
=
null
;
private
WSS4JOutInterceptor
wss4JOutInterceptor
=
null
;
public
static
WSS4JOutInterceptor
getWSS4JOutInterceptor
(
String
username
,
String
password
,
PasswordType
passwordType
)
{
public
WSS4JOutInterceptor
getWSS4JOutInterceptor
(
)
{
if
(
wss4JOutInterceptor
==
null
)
{
synchronized
(
wss4JOutInterceptor
)
{
if
(
wss4JOutInterceptor
==
null
)
{
Map
<
String
,
Object
>
pro
=
new
HashMap
<
String
,
Object
>();
pro
.
put
(
WSHandlerConstants
.
ACTION
,
WSHandlerConstants
.
USERNAME_TOKEN
);
pro
.
put
(
WSHandlerConstants
.
USER
,
username
);
pro
.
put
(
WSHandlerConstants
.
PASSWORD_TYPE
,
passwordType
==
null
?
PasswordType
.
PasswordText
.
name
()
:
passwordType
.
name
());
pro
.
put
(
WSHandlerConstants
.
PASSWORD_TYPE
,
PasswordType
.
PasswordText
.
name
());
pro
.
put
(
WSHandlerConstants
.
PW_CALLBACK_REF
,
new
CallbackHandler
()
{
public
void
handle
(
Callback
[]
callbacks
)
{
for
(
int
i
=
0
;
i
<
callbacks
.
length
;
i
++)
{
...
...
src/main/java/com/egolm/sso/clients/Z_MI_SD_009_SO_CREATION/ZMISD009SOCREATIONServiceTask.java
View file @
117c4d3a
...
...
@@ -17,7 +17,6 @@ import org.springframework.scheduling.annotation.Scheduled;
import
org.springframework.stereotype.Component
;
import
com.egolm.sso.clients.ServiceFactory
;
import
com.egolm.sso.clients.ServiceFactory.PasswordType
;
import
com.egolm.sso.clients.Z_MI_SD_009_SO_CREATION.ZDTSD009SOCREATION.Header
;
import
com.egolm.sso.clients.Z_MI_SD_009_SO_CREATION.ZDTSD009SOCREATION.ITEM
;
import
com.egolm.sso.config.XRException
;
...
...
@@ -26,9 +25,9 @@ import com.egolm.sso.services.TraceService;
import
com.egolm.sso.util.DateUtil
;
import
com.egolm.sso.util.FileUtil
;
import
com.egolm.sso.util.SqlUtil
;
import
com.egolm.sso.util.SqlUtil.Page
;
import
com.egolm.sso.util.ThrowableUtil
;
import
com.egolm.sso.util.XMLUtil
;
import
com.egolm.sso.util.SqlUtil.Page
;
import
com.google.gson.Gson
;
@Component
...
...
@@ -57,6 +56,9 @@ public class ZMISD009SOCREATIONServiceTask {
@Value
(
"${xmlRoot}"
)
private
String
xmlRoot
;
@Autowired
private
ServiceFactory
factory
;
@Scheduled
(
cron
=
"${cronSap009}"
)
public
void
execute
()
{
this
.
runTask
();
...
...
@@ -68,7 +70,7 @@ public class ZMISD009SOCREATIONServiceTask {
File
folder
=
jarFile
.
getParentFile
();
String
absolutePath
=
folder
.
getAbsolutePath
();
String
wsdlLocation
=
"file:///"
+
absolutePath
+
"/"
+
WSDLPATH
+
"/Z_MI_SD_009_SO_CREATION.wsdl"
;
ZMISD009SOCREATION
service
=
ServiceFactory
.
create
(
ZMISD009SOCREATION
.
class
,
wsdlLocation
,
ZMISD009SOCREATIONService
.
SERVICE
,
ZMISD009SOCREATIONService
.
ZMISD009SOCREATIONPort
,
username
,
password
,
PasswordType
.
PasswordTex
t
);
ZMISD009SOCREATION
service
=
factory
.
create
(
ZMISD009SOCREATION
.
class
,
wsdlLocation
,
ZMISD009SOCREATIONService
.
SERVICE
,
ZMISD009SOCREATIONService
.
ZMISD009SOCREATIONPor
t
);
this
.
sendData
(
service
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment