无法接收对BPEL流程的HumanTask响应

时间:2015-06-26 06:21:20

标签: wsdl wso2 bpel


我对WSO2 BPS 3.2.0和BPEL都很陌生。我使用bpel4people扩展创建了一个用于触发HumanTask的BPEL流程。为此我拿了BPS随附的样本humantask。我可以成功解雇任务。但是一旦我完成任务,我的bpel过程就不会收到任务的响应。是否有任何特殊的程序来获得休息?这是我的bpel过程和HumanTask的WSDL文件。

bpel文件..



<!-- JavaTraining BPEL Process [Generated by the Eclipse BPEL Designer] -->
<!-- Date: Mon Mar 05 12:13:11 IST 2012 -->
<bpel:process name="JavaTraining" targetNamespace="http://loits.com/bps/training" suppressJoinFailure="yes" xmlns:tns="http://loits.com/bps/training" xmlns:bpel="http://docs.oasis-open.org/wsbpel/2.0/process/executable" xmlns:ns1="http://www.w3.org/2001/XMLSchema"
xmlns:ns2="http://www.example.com/claims/" xmlns:xsd="http://www.example.com/claims/schema" xmlns:b4p="http://docs.oasis-open.org/ns/bpel4people/bpel4people/200803">

  <!-- Import the client WSDL -->
  <bpel:extensions>
    <bpel:extension namespace="http://docs.oasis-open.org/ns/bpel4people/bpel4people/200803" mustUnderstand="yes"></bpel:extension>
  </bpel:extensions>
  <bpel:import namespace="http://www.example.com/claims/" location="ClaimsApprovalTask.wsdl" importType="http://schemas.xmlsoap.org/wsdl/"></bpel:import>
  <bpel:import location="JavaTrainingArtifacts.wsdl" namespace="http://loits.com/bps/training" 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:JavaTraining" myRole="JavaTrainingProvider" />
    <bpel:partnerLink name="b4pPtlnk" partnerLinkType="tns:b4pPtlnkType" myRole="requester" partnerRole="receiever"></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:JavaTrainingRequestMessage" />

    <!-- 
          Reference to the message that will be returned to the requester
          -->
    <bpel:variable name="output" messageType="tns:JavaTrainingResponseMessage" />
    <bpel:variable name="dummyVar" type="ns1:boolean"></bpel:variable>
    <bpel:variable name="b4pIn" messageType="ns2:ClaimApprovalRequest"></bpel:variable>
    <bpel:variable name="b4pOut" messageType="ns2:ClaimApprovalResponse"></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 JavaTraining.wsdl 
             -->
    <bpel:receive name="receiveInput" partnerLink="client" portType="tns:JavaTraining" operation="process" variable="input" createInstance="yes" />

    <!-- Generate reply to synchronous request -->
    <bpel:if name="If_amount_1000">
      <bpel:condition expressionLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath1.0">
        <![CDATA[number($input.payload/tns:amount) > number(1000)]]>
      </bpel:condition>
      <bpel:sequence>
        <bpel:assign validate="no" name="Assign1">
          <bpel:copy>
            <bpel:from>
              <bpel:literal>
                <tschema:ClaimApprovalData xmlns:tschema="http://www.example.com/claims/schema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
                  <tschema:cust>
                    <tschema:id>tschema:id</tschema:id>
                    <tschema:firstname>tschema:firstname</tschema:firstname>
                    <tschema:lastname>tschema:lastname</tschema:lastname>
                  </tschema:cust>
                  <tschema:amount>0.0</tschema:amount>
                  <tschema:region>tschema:region</tschema:region>
                  <tschema:priority>0</tschema:priority>
                </tschema:ClaimApprovalData>
              </bpel:literal>
            </bpel:from>
            <bpel:to variable="b4pIn" part="ClaimApprovalRequest"></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:customer/tns:custId]]>
              </bpel:query>
            </bpel:from>
            <bpel:to part="ClaimApprovalRequest" variable="b4pIn">
              <bpel:query queryLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath1.0">
                <![CDATA[xsd:cust/xsd:id]]>
              </bpel:query>
            </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:customer/tns:firstName]]>
              </bpel:query>
            </bpel:from>
            <bpel:to part="ClaimApprovalRequest" variable="b4pIn">
              <bpel:query queryLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath1.0">
                <![CDATA[xsd:cust/xsd:firstname]]>
              </bpel:query>
            </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:customer/tns:lastName]]>
              </bpel:query>
            </bpel:from>
            <bpel:to part="ClaimApprovalRequest" variable="b4pIn">
              <bpel:query queryLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath1.0">
                <![CDATA[xsd:cust/xsd:lastname]]>
              </bpel:query>
            </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:amount]]>
              </bpel:query>
            </bpel:from>
            <bpel:to part="ClaimApprovalRequest" variable="b4pIn">
              <bpel:query queryLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath1.0">
                <![CDATA[xsd:amount]]>
              </bpel:query>
            </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:priority]]>
              </bpel:query>
            </bpel:from>
            <bpel:to part="ClaimApprovalRequest" variable="b4pIn">
              <bpel:query queryLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath1.0">
                <![CDATA[xsd:priority]]>
              </bpel:query>
            </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:region]]>
              </bpel:query>
            </bpel:from>
            <bpel:to part="ClaimApprovalRequest" variable="b4pIn">
              <bpel:query queryLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath1.0">
                <![CDATA[xsd:region]]>
              </bpel:query>
            </bpel:to>
          </bpel:copy>

        </bpel:assign>
        <bpel:extensionActivity>
          <b4p:peopleActivity name="HumanTask" inputVariable="b4pIn" outputVariable="b4pOut">
            <b4p:remoteTask partnerLink="b4pPtlnk" operation="approve" responseOperation="approvalResponse"></b4p:remoteTask>
          </b4p:peopleActivity>
        </bpel:extensionActivity>

        <bpel:assign validate="no" name="Assign3">
          <bpel:copy>
            <bpel:from part="ClaimApprovalResponse" variable="b4pOut">
              <bpel:query queryLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath1.0">
                <![CDATA[xsd:approved]]>
              </bpel:query>
            </bpel:from>
            <bpel:to variable="dummyVar"></bpel:to>
          </bpel:copy>
        </bpel:assign>
        <bpel:if name="If_approved">
          <bpel:condition expressionLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath1.0">
            <![CDATA[$dummyVar = true()]]>
          </bpel:condition>
          <bpel:assign validate="no" name="Assign">
            <bpel:copy>
              <bpel:from>
                <bpel:literal>
                  <tns:JavaTrainingResponse xmlns:tns="http://loits.com/bps/training" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
                    <tns:result>tns:result</tns:result>
                  </tns:JavaTrainingResponse>
                </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["Approved"]]>
              </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:else>
            <bpel:assign validate="no" name="Assign4">
              <bpel:copy>
                <bpel:from>
                  <bpel:literal>
                    <tns:JavaTrainingResponse xmlns:tns="http://loits.com/bps/training" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
                      <tns:result>tns:result</tns:result>
                    </tns:JavaTrainingResponse>
                  </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["Rejected"]]>
                </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:else>
        </bpel:if>
      </bpel:sequence>
      <bpel:else>
        <bpel:assign validate="no" name="Assign2">

          <bpel:copy>
            <bpel:from>
              <bpel:literal>
                <tns:JavaTrainingResponse xmlns:tns="http://loits.com/bps/training" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
                  <tns:result>tns:result</tns:result>
                </tns:JavaTrainingResponse>
              </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["Approved Automatically"]]>
            </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:else>
    </bpel:if>
    <bpel:reply name="replyOutput" partnerLink="client" portType="tns:JavaTraining" operation="process" variable="output" />
  </bpel:sequence>
</bpel:process>
&#13;
&#13;
&#13;


和wsdl ..

&#13;
&#13;
<?xml version="1.0" encoding="UTF-8" ?>
<wsdl:definitions name="ClaimApproval" targetNamespace="http://www.example.com/claims/" xmlns:tns="http://www.example.com/claims/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:tschema="http://www.example.com/claims/schema"
xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:plnk="http://docs.oasis-open.org/wsbpel/2.0/plnktype">
  <wsdl:documentation>
    Example for WS-HumanTask 1.1 - WS-HumanTask Task Interface Definition
  </wsdl:documentation>
  <wsdl:types>
    <xsd:schema targetNamespace="http://www.example.com/claims/schema" xmlns:tns="http://www.example.com/claims/schema" xmlns:xsd="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
      <xsd:element name="ClaimApprovalData" type="tns:ClaimApprovalDataType" />
      <xsd:complexType name="ClaimApprovalDataType">
        <xsd:sequence>
          <xsd:element name="cust">
            <xsd:complexType>
              <xsd:sequence>
                <xsd:element name="id" type="xsd:string">
                </xsd:element>
                <xsd:element name="firstname" type="xsd:string">
                </xsd:element>
                <xsd:element name="lastname" type="xsd:string">
                </xsd:element>
              </xsd:sequence>
            </xsd:complexType>
          </xsd:element>

          <xsd:element name="amount" type="xsd:double" />
          <xsd:element name="region" type="xsd:string" />
          <xsd:element name="priority" type="xsd:int" />
        </xsd:sequence>
      </xsd:complexType>
      <xsd:element name="ClaimApprovalNotificationData" type="tns:ClaimApprovalNotificationDataType" />
      <xsd:complexType name="ClaimApprovalNotificationDataType">
        <xsd:sequence>
          <xsd:element name="firstname" type="xsd:string" />
          <xsd:element name="lastname" type="xsd:string" />
        </xsd:sequence>
      </xsd:complexType>
      <xsd:element name="ClaimApprovalResponse" type="tns:ClaimApprovalResponseType"></xsd:element>
      <xsd:complexType name="ClaimApprovalResponseType">
        <xsd:sequence>
          <xsd:element name="approved" type="xsd:boolean"></xsd:element>
        </xsd:sequence>
      </xsd:complexType>
    </xsd:schema>
  </wsdl:types>

  <wsdl:message name="ClaimApprovalRequest">
    <wsdl:part name="ClaimApprovalRequest" element="tschema:ClaimApprovalData" />
  </wsdl:message>

  <wsdl:message name="ClaimApprovalResponse">
    <wsdl:part name="ClaimApprovalResponse" element="tschema:ClaimApprovalResponse" />
  </wsdl:message>

  <wsdl:message name="ClaimApprovalNotificationRequest">
    <wsdl:part name="ClaimApprovalNotificationRequest" element="tschema:ClaimApprovalNotificationData" />
  </wsdl:message>

  <wsdl:portType name="ClaimsHandlingPT">
    <wsdl:operation name="approve">
      <wsdl:input message="tns:ClaimApprovalRequest" />
    </wsdl:operation>

    <wsdl:operation name="escalate">
      <wsdl:input message="tns:ClaimApprovalRequest" />
    </wsdl:operation>
  </wsdl:portType>

  <wsdl:portType name="ClaimsHandlingCallbackPT">
    <wsdl:operation name="approvalResponse">
      <wsdl:input message="tns:ClaimApprovalResponse" />
    </wsdl:operation>
  </wsdl:portType>

  <wsdl:portType name="ClaimApprovalReminderPT">
    <wsdl:operation name="notify">
      <wsdl:input message="tns:ClaimApprovalNotificationRequest" />
    </wsdl:operation>
  </wsdl:portType>

  <wsdl:binding name="ClaimSoapBinding" type="tns:ClaimsHandlingPT">
    <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" />
    <wsdl:operation name="approve">
      <soap:operation soapAction="urn:approve" style="document" />
      <wsdl:input>
        <soap:body use="literal" namespace="http://www.example.com/claims/" />
      </wsdl:input>
    </wsdl:operation>
    <wsdl:operation name="escalate">
      <soap:operation soapAction="urn:escalate" style="document" />
      <wsdl:input>
        <soap:body use="literal" />
      </wsdl:input>
    </wsdl:operation>
  </wsdl:binding>
  <wsdl:binding name="ClaimSoapBindingReminder" type="tns:ClaimApprovalReminderPT">
    <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" />
    <wsdl:operation name="notify">
      <soap:operation soapAction="urn:notify" style="document" />
      <wsdl:input>
        <soap:body use="literal" />
      </wsdl:input>
    </wsdl:operation>
  </wsdl:binding>
  <wsdl:binding name="ClaimSoapBindingCB" type="tns:ClaimsHandlingCallbackPT">
    <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" />
    <wsdl:operation name="approvalResponse">
      <soap:operation soapAction="urn:approvalResponse" style="document" />
      <wsdl:input>
        <soap:body use="literal" />
      </wsdl:input>
      <wsdl:output>
        <soap:body use="literal" />
      </wsdl:output>
    </wsdl:operation>
  </wsdl:binding>

  <wsdl:service name="ClaimService">
    <wsdl:port name="ClaimPort" binding="tns:ClaimSoapBinding">
      <soap:address location="http://localhost:9763/services/ClaimService" />
    </wsdl:port>
  </wsdl:service>
  <wsdl:service name="ClaimReminderService">
    <wsdl:port name="ClaimReminderPort" binding="tns:ClaimSoapBindingReminder">
      <soap:address location="http://localhost:9763/services/ClaimReminderService" />
    </wsdl:port>
  </wsdl:service>
  <wsdl:service name="ClaimServiceCB">
    <wsdl:port name="ClaimPortCB" binding="tns:ClaimSoapBindingCB">
      <soap:address location="http://localhost:9763/services/ClaimServiceCB" />
    </wsdl:port>

  </wsdl:service>

</wsdl:definitions>
&#13;
&#13;
&#13;

1 个答案:

答案 0 :(得分:0)

最后我能做到。
我们需要做的是将correlationFilter属性添加到deploy.xml文件中的相应提供活动 通过添加此命名空间将提供b4pFilter

xmlns:b4p="http://docs.oasis-open.org/ns/bpel4people/bpel4people/200803"

<provide partnerLink="b4p" correlationFilter="b4p:b4pFilter">
      <service name="biApprove:ClaimServiceCB" port="ClaimPortCB"/>
</provide>

deploy.xml的完整代码

<?xml version="1.0" encoding="UTF-8"?>
<deploy xmlns="http://www.apache.org/ode/schemas/dd/2007/03" 
xmlns:biApprove="http://www.example.com/claims/" 
xmlns:sample="http://loits.com/bps/training"
xmlns:b4p="http://docs.oasis-open.org/ns/bpel4people/bpel4people/200803">
  <process name="sample:JavaTraining">
    <active>true</active>
    <retired>false</retired>
    <process-events generate="all"/>
    <provide partnerLink="client">
      <service name="sample:BpelTest" port="BpelTestPort"/>
    </provide>
    <provide partnerLink="b4p" correlationFilter="b4p:b4pFilter">
      <service name="biApprove:ClaimServiceCB" port="ClaimPortCB"/>
    </provide>
    <invoke partnerLink="b4p">
      <service name="biApprove:ClaimService" port="ClaimPort"/>
    </invoke>
  </process>
</deploy>