Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
weixin_42566577
o2oa
提交
1914631b
o2oa
项目概览
weixin_42566577
/
o2oa
与 Fork 源项目一致
Fork自
浙江兰德纵横网络技术股份有限公司 / o2oa
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
o2oa
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
1914631b
编写于
6月 15, 2021
作者:
O
o2null
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
修正jaxws和jaxrs调用的脚本返回
上级
5b02659d
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
51 addition
and
32 deletion
+51
-32
o2server/x_base_core_project/src/main/java/com/x/base/core/project/webservices/WebservicesClient.java
...om/x/base/core/project/webservices/WebservicesClient.java
+3
-6
o2server/x_processplatform_service_processing/src/main/java/com/x/processplatform/service/processing/processor/invoke/InvokeExecutor.java
...m/service/processing/processor/invoke/InvokeExecutor.java
+1
-1
o2server/x_processplatform_service_processing/src/main/java/com/x/processplatform/service/processing/processor/invoke/InvokeProcessor.java
.../service/processing/processor/invoke/InvokeProcessor.java
+47
-25
未找到文件。
o2server/x_base_core_project/src/main/java/com/x/base/core/project/webservices/WebservicesClient.java
浏览文件 @
1914631b
...
...
@@ -4,14 +4,11 @@ import org.apache.cxf.endpoint.Client;
import
org.apache.cxf.jaxws.endpoint.dynamic.JaxWsDynamicClientFactory
;
public
class
WebservicesClient
{
public
Object
[]
jaxws
(
String
wsdl
,
String
method
,
Object
...
objects
)
{
public
Object
[]
jaxws
(
String
wsdl
,
String
method
,
Object
...
objects
)
throws
Exception
{
Object
[]
result
=
null
;
try
{
JaxWsDynamicClientFactory
dcf
=
JaxWsDynamicClientFactory
.
newInstance
();
Client
client
=
dcf
.
createClient
(
wsdl
);
JaxWsDynamicClientFactory
dcf
=
JaxWsDynamicClientFactory
.
newInstance
();
try
(
Client
client
=
dcf
.
createClient
(
wsdl
))
{
result
=
client
.
invoke
(
method
,
objects
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
return
result
;
}
...
...
o2server/x_processplatform_service_processing/src/main/java/com/x/processplatform/service/processing/processor/invoke/InvokeExecutor.java
浏览文件 @
1914631b
...
...
@@ -48,7 +48,7 @@ public class InvokeExecutor {
return
result
;
}
public
Object
execute
(
JaxwsObject
o
)
{
public
Object
[]
execute
(
JaxwsObject
o
)
throws
Exception
{
WebservicesClient
client
=
new
WebservicesClient
();
return
client
.
jaxws
(
o
.
getAddress
(),
o
.
getMethod
(),
o
.
getParameters
());
}
...
...
o2server/x_processplatform_service_processing/src/main/java/com/x/processplatform/service/processing/processor/invoke/InvokeProcessor.java
浏览文件 @
1914631b
...
...
@@ -55,17 +55,22 @@ public class InvokeProcessor extends AbstractInvokeProcessor {
aeiObjects
.
getProcessingAttributes
()
.
push
(
Signal
.
invokeExecute
(
aeiObjects
.
getWork
().
getActivityToken
(),
invoke
));
List
<
Work
>
results
=
new
ArrayList
<>();
boolean
passThrough
=
false
;
switch
(
invoke
.
getInvokeMode
())
{
case
jaxws:
this
.
jaxws
(
aeiObjects
,
invoke
);
// 可以根据返回脚本判断时候流转
passThrough
=
this
.
jaxws
(
aeiObjects
,
invoke
);
break
;
case
jaxrs:
this
.
jaxrs
(
aeiObjects
,
invoke
);
// 可以根据返回脚本判断时候流转
passThrough
=
this
.
jaxrs
(
aeiObjects
,
invoke
);
break
;
default
:
break
;
}
results
.
add
(
aeiObjects
.
getWork
());
if
(
passThrough
)
{
results
.
add
(
aeiObjects
.
getWork
());
}
return
results
;
}
...
...
@@ -79,29 +84,31 @@ public class InvokeProcessor extends AbstractInvokeProcessor {
return
results
;
}
private
void
jaxws
(
AeiObjects
aeiObjects
,
Invoke
invoke
)
throws
Exception
{
private
boolean
jaxws
(
AeiObjects
aeiObjects
,
Invoke
invoke
)
throws
Exception
{
if
(
BooleanUtils
.
isTrue
(
invoke
.
getInternal
()))
{
this
.
jaxwsInternal
(
aeiObjects
,
invoke
);
return
this
.
jaxwsInternal
(
aeiObjects
,
invoke
);
}
else
{
this
.
jaxwsExternal
(
aeiObjects
,
invoke
);
return
this
.
jaxwsExternal
(
aeiObjects
,
invoke
);
}
}
private
void
jaxwsInternal
(
AeiObjects
aeiObjects
,
Invoke
invoke
)
throws
Exception
{
// nothing
private
boolean
jaxwsInternal
(
AeiObjects
aeiObjects
,
Invoke
invoke
)
throws
Exception
{
return
true
;
}
private
void
jaxwsExternal
(
AeiObjects
aeiObjects
,
Invoke
invoke
)
throws
Exception
{
private
boolean
jaxwsExternal
(
AeiObjects
aeiObjects
,
Invoke
invoke
)
throws
Exception
{
Object
[]
parameters
=
this
.
jaxwsEvalParameters
(
aeiObjects
,
invoke
);
JaxwsObject
jaxwsObject
=
new
JaxwsObject
();
jaxwsObject
.
setAddress
(
invoke
.
getJaxwsAddress
());
jaxwsObject
.
setMethod
(
invoke
.
getJaxwsMethod
());
jaxwsObject
.
setParameters
(
parameters
);
boolean
passThrough
=
false
;
if
(
BooleanUtils
.
isTrue
(
invoke
.
getAsync
()))
{
ThisApplication
.
syncJaxwsInvokeQueue
.
send
(
jaxwsObject
);
passThrough
=
true
;
}
else
{
InvokeExecutor
executor
=
new
InvokeExecutor
();
Object
response
=
executor
.
execute
(
jaxwsObject
);
Object
[]
response
=
executor
.
execute
(
jaxwsObject
);
if
((
StringUtils
.
isNotEmpty
(
invoke
.
getJaxwsResponseScript
()))
||
(
StringUtils
.
isNotEmpty
(
invoke
.
getJaxwsResponseScriptText
())))
{
ScriptContext
scriptContext
=
aeiObjects
.
scriptContext
();
...
...
@@ -110,9 +117,12 @@ public class InvokeProcessor extends AbstractInvokeProcessor {
Business
.
EVENT_INVOKEJAXWSRESPONSE
);
scriptContext
.
getBindings
(
ScriptContext
.
ENGINE_SCOPE
).
put
(
ScriptFactory
.
BINDING_NAME_JAXWSRESPONSE
,
response
);
cs
.
eval
(
scriptContext
);
passThrough
=
ScriptFactory
.
asBoolean
(
cs
.
eval
(
scriptContext
));
}
else
{
passThrough
=
true
;
}
}
return
passThrough
;
}
private
Object
[]
jaxwsEvalParameters
(
AeiObjects
aeiObjects
,
Invoke
invoke
)
throws
Exception
{
...
...
@@ -129,15 +139,15 @@ public class InvokeProcessor extends AbstractInvokeProcessor {
return
parameters
.
toArray
();
}
private
void
jaxrs
(
AeiObjects
aeiObjects
,
Invoke
invoke
)
throws
Exception
{
private
boolean
jaxrs
(
AeiObjects
aeiObjects
,
Invoke
invoke
)
throws
Exception
{
if
(
BooleanUtils
.
isTrue
(
invoke
.
getInternal
()))
{
this
.
jaxrsInternal
(
aeiObjects
,
invoke
);
return
this
.
jaxrsInternal
(
aeiObjects
,
invoke
);
}
else
{
this
.
jaxrsExternal
(
aeiObjects
,
invoke
);
return
this
.
jaxrsExternal
(
aeiObjects
,
invoke
);
}
}
private
void
jaxrsInternal
(
AeiObjects
aeiObjects
,
Invoke
invoke
)
throws
Exception
{
private
boolean
jaxrsInternal
(
AeiObjects
aeiObjects
,
Invoke
invoke
)
throws
Exception
{
ActionResponse
resp
=
null
;
Class
<?>
clz
=
Class
.
forName
(
"com.x.base.core.project."
+
invoke
.
getInternalProject
());
String
uri
=
this
.
jaxrsUrl
(
aeiObjects
,
invoke
);
...
...
@@ -170,6 +180,7 @@ public class InvokeProcessor extends AbstractInvokeProcessor {
&&
((
null
==
resp
)
||
(!
Objects
.
equals
(
Type
.
success
,
resp
.
getType
()))))
{
throw
new
RunningException
(
"invoke url:{} not success, work:{}."
,
uri
,
aeiObjects
.
getWork
().
getId
());
}
boolean
passThrough
=
false
;
if
(!
BooleanUtils
.
isTrue
(
invoke
.
getAsync
()))
{
WrapScriptObject
jaxrsResponse
=
new
WrapScriptObject
();
if
(
null
!=
resp
)
{
...
...
@@ -183,9 +194,14 @@ public class InvokeProcessor extends AbstractInvokeProcessor {
Business
.
EVENT_INVOKEJAXRSRESPONSE
);
scriptContext
.
getBindings
(
ScriptContext
.
ENGINE_SCOPE
).
put
(
ScriptFactory
.
BINDING_NAME_JAXRSRESPONSE
,
jaxrsResponse
);
cs
.
eval
(
scriptContext
);
passThrough
=
ScriptFactory
.
asBoolean
(
cs
.
eval
(
scriptContext
));
}
else
{
passThrough
=
true
;
}
}
else
{
passThrough
=
true
;
}
return
passThrough
;
}
private
ActionResponse
jaxrsInternalDelete
(
AeiObjects
aeiObjects
,
Invoke
invoke
,
Class
<?>
clz
,
String
uri
)
...
...
@@ -216,10 +232,10 @@ public class InvokeProcessor extends AbstractInvokeProcessor {
jaxrsObject
.
setMethod
(
ConnectionAction
.
METHOD_GET
);
jaxrsObject
.
setContentType
(
invoke
.
getJaxrsContentType
());
ThisApplication
.
syncJaxrsInvokeQueue
.
send
(
jaxrsObject
);
return
null
;
}
else
{
return
ThisApplication
.
context
().
applications
().
getQuery
(
clz
,
uri
);
}
return
null
;
}
private
ActionResponse
jaxrsInternalPut
(
AeiObjects
aeiObjects
,
Invoke
invoke
,
Class
<?>
clz
,
String
uri
)
...
...
@@ -235,10 +251,10 @@ public class InvokeProcessor extends AbstractInvokeProcessor {
jaxrsObject
.
setMethod
(
ConnectionAction
.
METHOD_PUT
);
jaxrsObject
.
setContentType
(
invoke
.
getJaxrsContentType
());
ThisApplication
.
syncJaxrsInvokeQueue
.
send
(
jaxrsObject
);
return
null
;
}
else
{
return
ThisApplication
.
context
().
applications
().
putQuery
(
clz
,
uri
,
body
);
}
return
null
;
}
private
ActionResponse
jaxrsInternalPost
(
AeiObjects
aeiObjects
,
Invoke
invoke
,
Class
<?>
clz
,
String
uri
)
...
...
@@ -254,13 +270,13 @@ public class InvokeProcessor extends AbstractInvokeProcessor {
jaxrsObject
.
setMethod
(
ConnectionAction
.
METHOD_POST
);
jaxrsObject
.
setContentType
(
invoke
.
getJaxrsContentType
());
ThisApplication
.
syncJaxrsInvokeQueue
.
send
(
jaxrsObject
);
return
null
;
}
else
{
return
ThisApplication
.
context
().
applications
().
postQuery
(
clz
,
uri
,
body
);
}
return
null
;
}
private
void
jaxrsExternal
(
AeiObjects
aeiObjects
,
Invoke
invoke
)
throws
Exception
{
private
boolean
jaxrsExternal
(
AeiObjects
aeiObjects
,
Invoke
invoke
)
throws
Exception
{
String
result
=
""
;
String
uri
=
this
.
jaxrsUrl
(
aeiObjects
,
invoke
);
JaxrsObject
jaxrsObject
=
new
JaxrsObject
();
...
...
@@ -293,6 +309,7 @@ public class InvokeProcessor extends AbstractInvokeProcessor {
if
((!
BooleanUtils
.
isTrue
(
invoke
.
getAsync
()))
&&
(
null
==
result
))
{
throw
new
RunningException
(
"invoke address:{} not success, work:{}."
,
uri
,
aeiObjects
.
getWork
().
getId
());
}
boolean
passThrough
=
false
;
if
(!
BooleanUtils
.
isTrue
(
invoke
.
getAsync
()))
{
WrapScriptObject
jaxrsResponse
=
new
WrapScriptObject
();
jaxrsResponse
.
set
(
result
);
...
...
@@ -304,9 +321,14 @@ public class InvokeProcessor extends AbstractInvokeProcessor {
Business
.
EVENT_INVOKEJAXRSRESPONSE
);
scriptContext
.
getBindings
(
ScriptContext
.
ENGINE_SCOPE
).
put
(
ScriptFactory
.
BINDING_NAME_JAXRSRESPONSE
,
jaxrsResponse
);
cs
.
eval
(
scriptContext
);
passThrough
=
ScriptFactory
.
asBoolean
(
cs
.
eval
(
scriptContext
));
}
else
{
passThrough
=
true
;
}
}
else
{
passThrough
=
true
;
}
return
passThrough
;
}
private
String
jaxrsExternalDelete
(
AeiObjects
aeiObjects
,
Invoke
invoke
,
String
address
,
JaxrsObject
jaxrsObject
)
...
...
@@ -317,11 +339,11 @@ public class InvokeProcessor extends AbstractInvokeProcessor {
jaxrsObject
.
setContentType
(
invoke
.
getJaxrsContentType
());
if
(
BooleanUtils
.
isTrue
(
invoke
.
getAsync
()))
{
ThisApplication
.
syncJaxrsInvokeQueue
.
send
(
jaxrsObject
);
return
null
;
}
else
{
InvokeExecutor
executor
=
new
InvokeExecutor
();
return
executor
.
execute
(
jaxrsObject
);
}
return
null
;
}
private
String
jaxrsExternalGet
(
AeiObjects
aeiObjects
,
Invoke
invoke
,
String
address
,
JaxrsObject
jaxrsObject
)
...
...
@@ -332,11 +354,11 @@ public class InvokeProcessor extends AbstractInvokeProcessor {
jaxrsObject
.
setContentType
(
invoke
.
getJaxrsContentType
());
if
(
BooleanUtils
.
isTrue
(
invoke
.
getAsync
()))
{
ThisApplication
.
syncJaxrsInvokeQueue
.
send
(
jaxrsObject
);
return
null
;
}
else
{
InvokeExecutor
executor
=
new
InvokeExecutor
();
return
executor
.
execute
(
jaxrsObject
);
}
return
null
;
}
private
String
jaxrsExternalPut
(
AeiObjects
aeiObjects
,
Invoke
invoke
,
String
address
,
JaxrsObject
jaxrsObject
)
...
...
@@ -349,11 +371,11 @@ public class InvokeProcessor extends AbstractInvokeProcessor {
jaxrsObject
.
setContentType
(
invoke
.
getJaxrsContentType
());
if
(
BooleanUtils
.
isTrue
(
invoke
.
getAsync
()))
{
ThisApplication
.
syncJaxrsInvokeQueue
.
send
(
jaxrsObject
);
return
null
;
}
else
{
InvokeExecutor
executor
=
new
InvokeExecutor
();
return
executor
.
execute
(
jaxrsObject
);
}
return
null
;
}
private
String
jaxrsExternalPost
(
AeiObjects
aeiObjects
,
Invoke
invoke
,
String
address
,
JaxrsObject
jaxrsObject
)
...
...
@@ -366,11 +388,11 @@ public class InvokeProcessor extends AbstractInvokeProcessor {
jaxrsObject
.
setContentType
(
invoke
.
getJaxrsContentType
());
if
(
BooleanUtils
.
isTrue
(
invoke
.
getAsync
()))
{
ThisApplication
.
syncJaxrsInvokeQueue
.
send
(
jaxrsObject
);
return
null
;
}
else
{
InvokeExecutor
executor
=
new
InvokeExecutor
();
return
executor
.
execute
(
jaxrsObject
);
}
return
null
;
}
private
String
jaxrsUrl
(
AeiObjects
aeiObjects
,
Invoke
invoke
)
throws
Exception
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录