0
請看下面的bpel代碼(WSO2)。WSO2-bpel:doXslTransform
<bpel:assign validate="no" name="Assign">
<bpel:copy>
<bpel:from>
bpel:doXslTransform("RequestAdd.xsl", $input.payload)
</bpel:from>
<bpel:to variable="Request" part="payload"></bpel:to>
</bpel:copy>
</bpel:assign>
我試圖在BPEL中使用xslt將輸入傳遞給外部附加服務。消息類型爲$input
和$request
。但似乎請求沒有正確傳遞給Addition服務。請幫我解決這個問題。下面是BPEL代碼
<!-- InvokeUsingXSLT BPEL Process [Generated by the Eclipse BPEL Designer] -->
<!-- Date: Mon Mar 05 12:13:11 IST 2012 -->
<bpel:process name="InvokeUsingXSLT"
targetNamespace="http://wso2.org/bps/sample"
suppressJoinFailure="yes"
xmlns:tns="http://wso2.org/bps/sample"
xmlns:bpel="http://docs.oasis-open.org/wsbpel/2.0/process/executable"
>
<!-- Import the client WSDL -->
<bpel:import namespace="http://wso2.org/bps/sample" location="AddService.wsdl" importType="http://schemas.xmlsoap.org/wsdl/"></bpel:import>
<bpel:import location="InvokeUsingXSLTArtifacts.wsdl" namespace="http://wso2.org/bps/sample"
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:InvokeUsingXSLT"
myRole="InvokeUsingXSLTProvider"
/>
<bpel:partnerLink name="Add_service" partnerLinkType="tns:Add_service" partnerRole="Add_serviceProvider"></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:InvokeUsingXSLTRequestMessage"/>
<!--
Reference to the message that will be returned to the requester
-->
<bpel:variable name="output"
messageType="tns:InvokeUsingXSLTResponseMessage"/>
<bpel:variable name="Request" messageType="tns:Add_serviceRequestMessage"></bpel:variable>
<bpel:variable name="Response" messageType="tns:Add_serviceResponseMessage"></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 InvokeUsingXSLT.wsdl
-->
<bpel:receive name="receiveInput" partnerLink="client"
portType="tns:InvokeUsingXSLT"
operation="process" variable="input"
createInstance="yes"/>
<!-- Generate reply to synchronous request -->
<bpel:assign validate="no" name="Assign">
<bpel:copy>
<bpel:from>
bpel:doXslTransform("RequestAdd.xsl", $input.payload)
</bpel:from>
<bpel:to variable="Request" part="payload"></bpel:to>
</bpel:copy>
</bpel:assign>
<bpel:log></bpel:log>
<bpel:invoke name="Invoke" partnerLink="Add_service" operation="process" portType="tns:Add_service" inputVariable="Request" outputVariable="Response"></bpel:invoke>
<bpel:assign validate="no" name="Assign1">
<bpel:copy>
<bpel:from><bpel:literal><tns:InvokeUsingXSLTResponse xmlns:tns="http://wso2.org/bps/sample" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<tns:result>0</tns:result>
</tns:InvokeUsingXSLTResponse>
</bpel:literal></bpel:from>
<bpel:to variable="output" part="payload"></bpel:to>
</bpel:copy>
<bpel:copy>
<bpel:from>
bpel:doXslTransform("ResponseAdd.xsl", $Response.payload)
</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="replyOutput"
partnerLink="client"
portType="tns:InvokeUsingXSLT"
operation="process"
variable="output"
/>
</bpel:sequence>
</bpel:process>