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
236739a0
Commit
236739a0
authored
Aug 13, 2019
by
Quxl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
x
parent
91bf6c59
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
15 deletions
+29
-15
SI004INVENTORYSyncOutServiceTask.java
...TORY_SyncOutService/SI004INVENTORYSyncOutServiceTask.java
+3
-2
ServiceFactory.java
src/main/java/com/egolm/sso/clients/ServiceFactory.java
+26
-13
No files found.
src/main/java/com/egolm/sso/clients/SI_004_INVENTORY_SyncOutService/SI004INVENTORYSyncOutServiceTask.java
View file @
236739a0
...
...
@@ -2,6 +2,7 @@ package com.egolm.sso.clients.SI_004_INVENTORY_SyncOutService;
import
java.io.File
;
import
java.math.BigInteger
;
import
java.net.MalformedURLException
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.List
;
...
...
@@ -59,11 +60,11 @@ public class SI004INVENTORYSyncOutServiceTask {
private
String
xmlRoot
;
@Scheduled
(
cron
=
"${cronSi004}"
)
public
void
execute
()
{
public
void
execute
()
throws
MalformedURLException
{
this
.
runTask
();
}
public
void
runTask
()
{
public
void
runTask
()
throws
MalformedURLException
{
ApplicationHome
home
=
new
ApplicationHome
(
getClass
());
File
jarFile
=
home
.
getSource
();
File
folder
=
jarFile
.
getParentFile
();
...
...
src/main/java/com/egolm/sso/clients/ServiceFactory.java
View file @
236739a0
...
...
@@ -21,28 +21,41 @@ public class ServiceFactory {
public
static
<
T
>
T
create
(
Class
<
T
>
requiredType
,
String
wsdlLocation
,
QName
serviceQName
,
QName
portQName
,
String
username
,
String
password
,
PasswordType
passwordType
)
{
try
{
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
.
PW_CALLBACK_REF
,
new
CallbackHandler
()
{
public
void
handle
(
Callback
[]
callbacks
)
{
for
(
int
i
=
0
;
i
<
callbacks
.
length
;
i
++)
{
WSPasswordCallback
pc
=
(
WSPasswordCallback
)
callbacks
[
i
];
pc
.
setPassword
(
password
);
}
}
});
URL
WSDL_URL
=
new
URL
(
wsdlLocation
);
Service
dyService
=
Service
.
create
(
WSDL_URL
,
serviceQName
);
T
service
=
dyService
.
getPort
(
portQName
,
requiredType
);
ClientProxy
.
getClient
(
service
).
getOutInterceptors
().
add
(
new
WSS4JOutInterceptor
(
pro
));
ClientProxy
.
getClient
(
service
).
getOutInterceptors
().
add
(
getWSS4JOutInterceptor
(
username
,
password
,
passwordType
));
return
service
;
}
catch
(
MalformedURLException
e
)
{
throw
new
XRException
(
e
);
}
}
private
static
WSS4JOutInterceptor
wss4JOutInterceptor
=
null
;
public
static
WSS4JOutInterceptor
getWSS4JOutInterceptor
(
String
username
,
String
password
,
PasswordType
passwordType
)
{
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
.
PW_CALLBACK_REF
,
new
CallbackHandler
()
{
public
void
handle
(
Callback
[]
callbacks
)
{
for
(
int
i
=
0
;
i
<
callbacks
.
length
;
i
++)
{
WSPasswordCallback
pc
=
(
WSPasswordCallback
)
callbacks
[
i
];
pc
.
setPassword
(
password
);
}
}
});
wss4JOutInterceptor
=
new
WSS4JOutInterceptor
(
pro
);
}
}
}
return
wss4JOutInterceptor
;
}
public
enum
PasswordType
{
PasswordText
,
PasswordNone
,
PasswordDigest
}
...
...
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