我正在使用Eclipse BPEL Designer和Apache ODE。然后,我尝试在catalina.out
中部署我的流程,我收到错误org.apache.ode.bpel.iapi.ContextException: Deploy failed; error: [CompilationErrors] Compilation completed with 1 error(s):
null:138: error: [UndeclaredVariable] Attempt to reference undeclared variable "expertSelectionResponse1"
。
这是我的BPEL代码: `
<bpel:process name="pskov"
targetNamespace="http://localhost.pskov"
suppressJoinFailure="yes"
xmlns:tns="http://localhost.pskov"
xmlns:bpel="http://docs.oasis-open.org/wsbpel/2.0/process/executable"
xmlns:ns="http://pskov.ru"
xmlns:ode="http://www.apache.org/ode/type/extension"
xmlns:ns0="http://createtask.pskov.ru/" xmlns:ns2="http://selectexpert.pskov.ru/">
<!-- Import the client WSDL -->
<bpel:import namespace="http://selectexpert.pskov.ru/" location="SelectExpert.wsdl"
importType="http://schemas.xmlsoap.org/wsdl/"></bpel:import>
<bpel:import namespace="http://createtask.pskov.ru/" location="CreateTaskwsdl.wsdl"
importType="http://schemas.xmlsoap.org/wsdl/"></bpel:import>
<bpel:import namespace="http://pskov.ru" location="InspectionWriter.wsdl"
importType="http://schemas.xmlsoap.org/wsdl/"></bpel:import>
<bpel:import location="pskovArtifacts.wsdl" namespace="http://localhost.pskov"
importType="http://schemas.xmlsoap.org/wsdl/" />
<!-- ================================================================= -->
<!-- PARTNERLINKS -->
<!-- List of services participating in this BPEL process -->
<!-- ================================================================= -->
<bpel:partnerLinks>
<!-- The 'client' role represents the requester of this service. -->
<bpel:partnerLink name="client"
partnerLinkType="tns:pskov"
myRole="pskovProvider"
/>
<bpel:partnerLink name="WriteInspectionPL"
partnerLinkType="tns:WriteINspectionPLT"
partnerRole="WriteInspectionRole"></bpel:partnerLink>
<bpel:partnerLink name="CreateTaskPL" partnerLinkType="tns:CreateTaskPLT"
partnerRole="CreateTaskRole"></bpel:partnerLink>
<bpel:partnerLink name="SelectExpertPL" partnerLinkType="tns:SelectExpertPLT"
partnerRole="SelectExpertRole"></bpel:partnerLink>
</bpel:partnerLinks>
<!-- ================================================================= -->
<!-- VARIABLES -->
<!-- List of messages and XML documents used within this BPEL process -->
<!-- ================================================================= -->
<bpel:variables>
<!-- Reference to the message passed as input during initiation -->
<bpel:variable name="input"
messageType="tns:pskovRequestMessage"/>
<!--
Reference to the message that will be returned to the requester
-->
<bpel:variable name="output"
messageType="tns:pskovResponseMessage"/>
<bpel:variable name="WriteInspectionPLResponse"
messageType="ns:writeToDBResponse">
</bpel:variable>
<bpel:variable name="WriteInspectionPLRequest" messageType="ns:writeToDBRequest">
</bpel:variable>
<bpel:variable name="CreateTaskPLResponse"
messageType="ns0:writeTaskToDBResponse">
</bpel:variable>
<bpel:variable name="CreateTaskPLRequest" messageType="ns0:writeTaskToDB">
</bpel:variable>
<bpel:variable name="SelectExpertPLResponse1"
messageType="ns2:expertSelectionResponse"></bpel:variable>
<bpel:variable name="SelectExpertPLRequest1" messageType="ns2:expertSelection">
</bpel:variable>
</bpel:variables>
<!-- ================================================================= -->
<!-- ORCHESTRATION LOGIC -->
<!-- Set of activities coordinating the flow of messages across the -->
<!-- services integrated within this business process -->
<!-- ================================================================= -->
<bpel:sequence name="main">
<!-- Receive input from requester.
Note: This maps to operation defined in pskov.wsdl
-->
<bpel:receive name="receiveInput" partnerLink="client"
portType="tns:pskov"
operation="process" createInstance="yes" variable="input"/>
<!-- Generate reply to synchronous request -->
<bpel:assign validate="no" name="CopyInstanceIDToOutput"><bpel:copy>
<bpel:from><bpel:literal><tns:pskovResponse
xmlns:tns="http://localhost.pskov" xmlns:xsi="http://www.w3.org/2001/XMLSchema-
instance">
<tns:result>tns:result</tns:result>
</tns:pskovResponse>
</bpel:literal></bpel:from>
<bpel:to variable="output" part="payload"></bpel:to>
</bpel:copy>
<bpel:copy>
<bpel:from
expressionLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath1.0">
<![CDATA[$ode:pid]]>
</bpel:from>
<bpel:to part="payload" variable="output">
<bpel:query
queryLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath1.0"><![CDATA[tns:result]]>
</bpel:query>
</bpel:to>
</bpel:copy>
</bpel:assign>
<bpel:reply name="replyOutputWithinstanceID" partnerLink="client"
portType="tns:pskov" operation="process" variable="output" />
<bpel:assign validate="no" name="CopyTagToSelectActivity">
<bpel:copy>
<bpel:from><bpel:literal><tns:pskovResponse
xmlns:tns="http://localhost.pskov" xmlns:xsi="http://www.w3.org/2001/XMLSchema-
instance">
<tns:result>ns2:expertSelectionResponse1</tns:result>
</tns:pskovResponse>
</bpel:literal></bpel:from>
<bpel:to variable="SelectExpertPLResponse1" part="return"></bpel:to>
</bpel:copy>
<bpel:copy>
<bpel:from part="payload" variable="input">
<bpel:query
queryLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath1.0"><![CDATA[tns:tagID]]>
</bpel:query>
</bpel:from>
<bpel:to part="arg0" variable="SelectExpertPLRequest1">
<bpel:query
queryLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath1.0"><![CDATA[ns2:arg0]]>
</bpel:query>
</bpel:to>
</bpel:copy>
</bpel:assign>
<bpel:invoke name="SelectExpertByTag" partnerLink="SelectExpertPL"
operation="expertSelection" portType="ns2:SelectExpertInterface"
inputVariable="SelectExpertPLRequest1" outputVariable="SelectExpertPLResponse1">
</bpel:invoke>
<bpel:assign validate="no" name="CopyExpertName">
<bpel:copy ignoreMissingFromData="yes">
<bpel:from
expressionLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath1.0">
<![CDATA[concat($ns2:expertSelectionResponse1.payload,"123","312","12")]]>
</bpel:from>
<bpel:to part="arg0" variable="CreateTaskPLRequest"></bpel:to>
</bpel:copy>
</bpel:assign>
<bpel:invoke name="CreateTask" partnerLink="CreateTaskPL" operation="writeTaskToDB"
portType="ns0:CreateTaskInterface" inputVariable="CreateTaskPLRequest"
outputVariable="CreateTaskPLResponse"></bpel:invoke>
<bpel:assign validate="no" name="CopyInputToWriteExpertiseResult">
<bpel:copy>
<bpel:from><bpel:literal><impl:writeToDB xmlns:impl="http://pskov.ru"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<impl:allParams>impl:allParams</impl:allParams>
</impl:writeToDB>
</bpel:literal></bpel:from>
<bpel:to variable="WriteInspectionPLRequest" part="parameters"></bpel:to>
</bpel:copy>
<bpel:copy ignoreMissingFromData="yes">
<bpel:from part="payload" variable="input">
<bpel:query
queryLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath1.0"><![CDATA[tns:input]]>
</bpel:query>
</bpel:from>
<bpel:to part="parameters" variable="WriteInspectionPLRequest">
<bpel:query
queryLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath1.0"><![CDATA[ns:allParams]]>
</bpel:query>
</bpel:to>
</bpel:copy>
</bpel:assign>
<bpel:invoke name="WriteExpertiseResult" partnerLink="WriteInspectionPL"
operation="writeToDB" portType="ns1:InspectionWriter"
inputVariable="WriteInspectionPLRequest" outputVariable="WriteInspectionPLResponse">
</bpel:invoke>
</bpel:sequence>
</bpel:process>`
据我所知,我需要初始化变量以让ODE知道它的类型。我做的。 你看到错误吗? 我该如何解决?
修改 此分配操作出错
<bpel:copy ignoreMissingFromData="yes">
<bpel:from
expressionLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath1.0">
<![CDATA[concat($ns2:expertSelectionResponse1.payload,
"123","312","12")]]>
</bpel:from>
<bpel:to part="arg0" variable="CreateTaskPLRequest"></bpel:to>
</bpel:copy>
</bpel:assign>`
答案 0 :(得分:1)
$ns2:expertSelectionResponse1.payload
不是有效的变量名称。正确的名称显然是SelectExpertPLResponse1
,声明为ns2:expertSelectionResponse
类型。因此,以下代码段应该可用:
<bpel:copy ignoreMissingFromData="yes">
<bpel:from expressionLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath1.0">
<![CDATA[concat($SelectExpertPLResponse1.payload, "123","312","12")]]>
</bpel:from>
<bpel:to part="arg0" variable="CreateTaskPLRequest"></bpel:to>
</bpel:copy>