我们正在配置WSO2 API管理器(版本2.1.0)以使用Application Creation工作流程。
为此,我们已经配置了BPS节点(版本3.6.0),如中所述 https://docs.wso2.com/display/AM210/Adding+an+Application+Creation+Workflow 另外,我们已完成了所述的调整 https://docs.wso2.com/display/AM210/Configuring+Workflows+in+a+Cluster 这是必需的,因为我们使用2个不同的节点,名称不同。
现在,应用程序创建过程/工作流程似乎工作正常,并且收到并处理了批准和拒绝。
但我们仍然有错误。 当我们登录管理应用程序(https://apimanager.example.com:9443/admin)时,我们在BPS节点中看到错误。
TID: [-1234] [] [2018-06-18 10:36:20,508] INFO {org.apache.axis2.builder.BuilderUtil} - OMException in getSOAPBuilder {org.apache.axis2.builder.BuilderUtil}
org.apache.axiom.om.OMException: com.ctc.wstx.exc.WstxEOFException: Unexpected EOF in prolog
我们在做任何事情之前都会看到这个错误,无论如何(没有任务,有待处理的任务和没有待处理的任务)
很明显,admin应用程序在登录时调用WebService,内容错误,但我们不知道如何调试它。我们如何知道在BPS节点中调用哪个服务?
欢迎任何建议。
下面,我们的安装脚本配置工作流程,以及我们正在使用的工作流程扩展
===========自动配置脚本==============
CMD_XMLSTARLET=xmlstarlet
CMD_JQ=jq
# configureWorkflow
# Configure workflows por human based approval processes
# Reference:
# Adding an Application Creation Workflow
# https://docs.wso2.com/display/AM210/Adding+an+Application+Creation+Workflow
# Adding an Application registration (generate keys) workflow
# https://docs.wso2.com/display/AM210/Adding+an+Application+Registration+Workflow
# Cluster configuration (change the host names)
# https://docs.wso2.com/display/AM210/Configuring+Workflows+in+a+Cluster
function configureWorkflow()
{
if [ -z $1 ] || [ -z $2 ]
then
echo "Indicate manager node and bps node. E.g. configureWorkflow APIM APIB" 1>&2
exit 1
else
# Namespaces
# Default namespace for humantask.xml
local nsh=http://wso2.org/humantask/schema/server/config
# Default namespace for b4p-coordination-config.xml
local nsb=http://wso2.org/bps/b4p/coordination/config
local svns=http://org.wso2.securevault/configuration
# WebServices
local wsa=http://www.w3.org/2005/08/addressing
local wsdl=http://schemas.xmlsoap.org/wsdl/
local soap=http://schemas.xmlsoap.org/wsdl/soap/
local soap12=http://schemas.xmlsoap.org/wsdl/soap12/
# Synapse
local nss=http://ws.apache.org/ns/synapse
# Configure workflow node
su -c "$CMD_XMLSTARLET ed -L -N x=$nsh -u //x:HumanTaskCoordination/x:TaskCoordinationEnabled -v true $WSO2_PATH/${NODE_NAME[$2]}/repository/conf/humantask.xml" $WSO2_USER_NAME
su -c "$CMD_XMLSTARLET ed -L -N x=$nsb -u //x:TaskCoordinationEnabled -v true $WSO2_PATH/${NODE_NAME[$2]}/repository/conf/b4p-coordination-config.xml" $WSO2_USER_NAME
# Configure the workflows services (launch)
su -c "$CMD_XMLSTARLET ed -L -N wsa=$wsa -u //wsa:EndpointReference/wsa:Address -v http://${NODE_HOST[$2]}:${NODE_PORT_HTTP_SERVLET[$2]}/services/ApplicationService $WSO2_PATH/${NODE_NAME[$1]}/business-processes/epr/ApplicationService.epr" $WSO2_USER_NAME
su -c "$CMD_XMLSTARLET ed -L -N wsa=$wsa -u //wsa:EndpointReference/wsa:Metadata/authorization-password -v $WSO2_ADMIN_PASS $WSO2_PATH/${NODE_NAME[$1]}/business-processes/epr/ApplicationService.epr" $WSO2_USER_NAME
# Configure the workflows services (callbacks)
su -c "$CMD_XMLSTARLET ed -L -N wsa=$wsa -u //wsa:EndpointReference/wsa:Address -v https://${NODE_HOST[$1]}:${NODE_PORT_HTTPS_NIOPT[$1]}/services/WorkflowCallbackService $WSO2_PATH/${NODE_NAME[$1]}/business-processes/epr/ApplicationCallbackService.epr" $WSO2_USER_NAME
su -c "$CMD_XMLSTARLET ed -L -N wsa=$wsa -u //wsa:EndpointReference/wsa:Metadata/authorization-password -v $WSO2_ADMIN_PASS $WSO2_PATH/${NODE_NAME[$1]}/business-processes/epr/ApplicationCallbackService.epr" $WSO2_USER_NAME
# Copy configured workflows from APIM to BPS
su -c "cp -r $WSO2_PATH/${NODE_NAME[$1]}/business-processes/epr $WSO2_PATH/${NODE_NAME[$2]}/repository/conf/" $WSO2_USER_NAME
# https://docs.wso2.com/display/AM180/Configuring+Workflows+in+a+Cluster
# Install BPEL Processes
su -c "mkdir $WSO2_PATH/${NODE_NAME[$2]}/repository/deployment/server/bpel" $WSO2_USER_NAME
su -c "cp $WSO2_PATH/${NODE_NAME[$1]}/business-processes/application-creation/BPEL/ApplicationApprovalWorkFlowProcess_1.0.0.zip $WSO2_PATH/${NODE_NAME[$2]}/repository/deployment/server/bpel" $WSO2_USER_NAME
su -c "cp $WSO2_PATH/${NODE_NAME[$1]}/business-processes/application-registration/BPEL/ApplicationRegistrationWorkflowProcess_1.0.0.zip $WSO2_PATH/${NODE_NAME[$2]}/repository/deployment/server/bpel" $WSO2_USER_NAME
su -c "cp $WSO2_PATH/${NODE_NAME[$1]}/business-processes/user-signup/BPEL/UserSignupApprovalProcess_1.0.0.zip $WSO2_PATH/${NODE_NAME[$2]}/repository/deployment/server/bpel/." $WSO2_USER_NAME
su -c "cp $WSO2_PATH/${NODE_NAME[$1]}/business-processes/subscription-creation/BPEL/SubscriptionApprovalWorkFlowProcess_1.0.0.zip $WSO2_PATH/${NODE_NAME[$2]}/repository/deployment/server/bpel" $WSO2_USER_NAME
# Install Human task processes
su -c "mkdir $WSO2_PATH/${NODE_NAME[$2]}/repository/deployment/server/humantasks" $WSO2_USER_NAME
su -c "cp $WSO2_PATH/${NODE_NAME[$1]}/business-processes/application-creation/HumanTask/ApplicationsApprovalTask-1.0.0.zip $WSO2_PATH/${NODE_NAME[$2]}/repository/deployment/server/humantasks" $WSO2_USER_NAME
su -c "cp $WSO2_PATH/${NODE_NAME[$1]}/business-processes/application-registration/HumanTask/ApplicationRegistrationTask-1.0.0.zip $WSO2_PATH/${NODE_NAME[$2]}/repository/deployment/server/humantasks" $WSO2_USER_NAME
su -c "cp $WSO2_PATH/${NODE_NAME[$1]}/business-processes/user-signup/HumanTask/UserApprovalTask-1.0.0.zip $WSO2_PATH/${NODE_NAME[$2]}/repository/deployment/server/humantasks" $WSO2_USER_NAME
su -c "cp $WSO2_PATH/${NODE_NAME[$1]}/business-processes/subscription-creation/HumanTask/SubscriptionsApprovalTask-1.0.0.zip $WSO2_PATH/${NODE_NAME[$2]}/repository/deployment/server/humantasks" $WSO2_USER_NAME
# Configure API Manager node
file=$WSO2_PATH/${NODE_NAME[$1]}/repository/deployment/server/jaggeryapps/admin/site/conf/site.json
# NOTICE: The site file is wrong, and cannot be parsed. Solve with a sed replace
wrongLine="\\\"https://<BPSHost>:<BPSPort>/services/\\\","
rightLine="\\\"https://<BPSHost>:<BPSPort>/services/\\\""
su -c "sed -i.bak 's=$wrongLine=$rightLine=' $file" $WSO2_USER_NAME
# Remove all javascript style comment lines (now allowed in jq)
su -c "sed -i 's=^[[:blank:]]*//.*$==g' $file" $WSO2_USER_NAME
# Worflow endpoint
su -c "$CMD_JQ '.workflows.workFlowServerURL = \"${NODE_URL_SERVICES[$2]}\"' $file > $TMPDIR/tmp.$$.site.json && mv $TMPDIR/tmp.$$.site.json $file" $WSO2_USER_NAME
# Callback proxy endpoints
local jaguri="${NODE_URL_HTTPS_SERVLET[$1]}/store/site/blocks/workflow/workflow-listener/ajax/workflow-listener.jag"
local soaphttps="${NODE_URL_HTTPS_NIOPT[$1]}/services/WorkflowCallbackService.WorkflowCallbackServiceHttpsSoap11Endpoint/"
local soaphttp="${NODE_URL_HTTP_NIOPT[$1]}/services/WorkflowCallbackService.WorkflowCallbackServiceHttpsSoap11Endpoint/"
local soap12https="${NODE_URL_HTTPS_NIOPT[$1]}/services/WorkflowCallbackService.WorkflowCallbackServiceHttpsSoap12Endpoint/"
local soap12http="${NODE_URL_HTTP_NIOPT[$1]}/services/WorkflowCallbackService.WorkflowCallbackServiceHttpsSoap12Endpoint/"
su -c "$CMD_XMLSTARLET ed -L -N nss=$nss -u \"//nss:proxy/nss:target/nss:inSequence/nss:send/nss:endpoint/nss:address/@uri\" -v $jaguri $WSO2_PATH/${NODE_NAME[$1]}/repository/deployment/server/synapse-configs/default/proxy-services/WorkflowCallbackService.xml" $WSO2_USER_NAME
su -c "$CMD_XMLSTARLET ed -L -N nss=$nss -N wsdl=$wsdl -N soap=$soap -u \"//nss:proxy/nss:publishWSDL/wsdl:definitions/wsdl:service/wsdl:port[@name='WorkflowCallbackServiceHttpsSoap11Endpoint']/soap:address/@location\" -v $soaphttps $WSO2_PATH/${NODE_NAME[$1]}/repository/deployment/server/synapse-configs/default/proxy-services/WorkflowCallbackService.xml" $WSO2_USER_NAME
su -c "$CMD_XMLSTARLET ed -L -N nss=$nss -N wsdl=$wsdl -N soap=$soap -u \"//nss:proxy/nss:publishWSDL/wsdl:definitions/wsdl:service/wsdl:port[@name='WorkflowCallbackServiceHttpSoap11Endpoint']/soap:address/@location\" -v $soaphttp $WSO2_PATH/${NODE_NAME[$1]}/repository/deployment/server/synapse-configs/default/proxy-services/WorkflowCallbackService.xml" $WSO2_USER_NAME
su -c "$CMD_XMLSTARLET ed -L -N nss=$nss -N wsdl=$wsdl -N soap12=$soap12 -u \"//nss:proxy/nss:publishWSDL/wsdl:definitions/wsdl:service/wsdl:port[@name='WorkflowCallbackServiceHttpsSoap12Endpoint']/soap12:address/@location\" -v $soap12https $WSO2_PATH/${NODE_NAME[$1]}/repository/deployment/server/synapse-configs/default/proxy-services/WorkflowCallbackService.xml" $WSO2_USER_NAME
su -c "$CMD_XMLSTARLET ed -L -N nss=$nss -N wsdl=$wsdl -N soap12=$soap12 -u \"//nss:proxy/nss:publishWSDL/wsdl:definitions/wsdl:service/wsdl:port[@name='WorkflowCallbackServiceHttpSoap12Endpoint']/soap12:address/@location\" -v $soap12http $WSO2_PATH/${NODE_NAME[$1]}/repository/deployment/server/synapse-configs/default/proxy-services/WorkflowCallbackService.xml" $WSO2_USER_NAME
fi
}
============= workflow-extensions.xml ================
<WorkFlowExtensions>
<ApplicationCreation executor="org.wso2.carbon.apimgt.impl.workflow.ApplicationCreationWSWorkflowExecutor">
<Property name="serviceEndpoint">http://apibps.example.com:9765/services/ApplicationApprovalWorkFlowProcess/</Property>
<Property name="username">admin</Property>
<Property name="password">xxxxx</Property>
<Property name="callbackURL">https://apimanager.example.com:8243/services/WorkflowCallbackService</Property>
</ApplicationCreation>
<ProductionApplicationRegistration executor="org.wso2.carbon.apimgt.impl.workflow.ApplicationRegistrationWSWorkflowExecutor">
<Property name="serviceEndpoint">http://apibps.example.com:9765/services/ApplicationRegistrationWorkFlowProcess/</Property>
<Property name="username">admin</Property>
<Property name="password">xxxxx</Property>
<Property name="callbackURL">https://apimanager.example.com:8243/services/WorkflowCallbackService</Property>
</ProductionApplicationRegistration>
<SandboxApplicationRegistration executor="org.wso2.carbon.apimgt.impl.workflow.ApplicationRegistrationWSWorkflowExecutor">
<Property name="serviceEndpoint">http://apibps.example.com:9765/services/ApplicationRegistrationWorkFlowProcess/</Property>
<Property name="username">admin</Property>
<Property name="password">xxxxx</Property>
<Property name="callbackURL">https://apimanager.example.com:8243/services/WorkflowCallbackService</Property>
</SandboxApplicationRegistration>
<SubscriptionCreation executor="org.wso2.carbon.apimgt.impl.workflow.SubscriptionCreationWSWorkflowExecutor">
<Property name="serviceEndpoint">http://apibps.example.com:9765/services/SubscriptionApprovalWorkFlowProcess/</Property>
<Property name="username">admin</Property>
<Property name="password">xxxxx</Property>
<Property name="callbackURL">https://apimanager.example.com:8243/services/WorkflowCallbackService</Property>
</SubscriptionCreation>
<UserSignUp executor="org.wso2.carbon.apimgt.impl.workflow.UserSignUpWSWorkflowExecutor">
<Property name="serviceEndpoint">http://apibps.example.com:9765/services/UserSignupProcess/</Property>
<Property name="username">admin</Property>
<Property name="password">xxxxx</Property>
<Property name="callbackURL">https://apimanager.example.com:8243/services/WorkflowCallbackService</Property>
</UserSignUp>
<!--
***NOTE:***
Users of deletion workflows are expected to implement their own deletion workflow executors and services.
By default API Manager only implements the core functionalities required to support deletion workflows and
simple deletion workflow executors. Default WS deletion workflow implementations are not available with the
distribution.
-->
<SubscriptionDeletion executor="org.wso2.carbon.apimgt.impl.workflow.SubscriptionDeletionSimpleWorkflowExecutor"/>
<!--SubscriptionDeletion executor="org.wso2.carbon.apimgt.impl.workflow.SubscriptionDeletionSimpleWorkflowExecutor">
<Property name="serviceEndpoint">http://localhost:9765/services/SubscriptionApprovalWorkFlowProcess/</Property>
<Property name="username">admin</Property>
<Property name="password">xxxxx</Property>
<Property name="callbackURL">https://localhost:8243/services/WorkflowCallbackService</Property>
</SubscriptionDeletion -->
<ApplicationDeletion executor="org.wso2.carbon.apimgt.impl.workflow.ApplicationDeletionSimpleWorkflowExecutor"/>
<!--ApplicationDeletion executor="org.wso2.carbon.apimgt.impl.workflow.ApplicationDeletionSimpleWorkflowExecutor">
<Property name="serviceEndpoint">http://localhost:9765/services/ApplicationApprovalWorkFlowProcess/</Property>
<Property name="username">admin</Property>
<Property name="password">xxxxx</Property>
<Property name="callbackURL">https://localhost:8243/services/WorkflowCallbackService</Property>
</ApplicationDeletion-->
<!-- Publisher related workflows -->
<APIStateChange executor="org.wso2.carbon.apimgt.impl.workflow.APIStateChangeSimpleWorkflowExecutor" />
<!-- <APIStateChange executor="org.wso2.carbon.apimgt.impl.workflow.APIStateChangeWSWorkflowExecutor">
<Property name="processDefinitionKey">APIStateChangeApprovalProcess</Property>
<Property name="stateList">Created:Publish,Published:Block</Property>
</APIStateChange>-->
</WorkFlowExtensions>