1 Reply Latest reply on Dec 20, 2005 12:16 PM by aguizar

    Asynchronize BPEL process and external partnerLink

    fwshk

      Excuse me,
      I would like to know, how to create Asynchronize BPEL process?

      I have define a process like:
      receive (partnerLink: client)
      assign
      invoke (two-way, partnerLink: MyMath)
      assign
      invoke (one-way, partnerLink: client)

      I deploy it similar as ATM example, it is success
      but when I written the test, I cannot get the result back.
      What are the mistakes I made?

      Another question, How to define partnerLink's location?
      I would like the partnerLink MyMath will locate in another host
      but I haven't found any definition about partnerLink's location.
      Could you tell me where can I locate the partnerLink?

      The below code is for reference usage:

      LoanRequest.bpel
      <?xml version="1.0" encoding="UTF-8"?>
      <process xmlns:bpws="http://schemas.xmlsoap.org/ws/2003/03/business-process/"
      xmlns="http://schemas.xmlsoap.org/ws/2003/03/business-process/"
      xmlns:imp1="http://learning/MyMath" xmlns:my="http://learning/LoanRequest"
      xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="LoanRequest"
      suppressJoinFailure="yes" targetNamespace="http://learning/LoanRequest">
       <partnerLinks>
       <partnerLink myRole="LoanRequestProvider" name="client"
       partnerLinkType="my:LoanRequest" partnerRole="LoanRequestRequester"/>
       <partnerLink name="MyMath" partnerLinkType="my:MyMathPartnerLinkType"
       partnerRole="MyMathPartnerRole"/>
       </partnerLinks>
       <variables>
       <variable messageType="imp1:inMessage" name="MyMathInput"/>
       <variable messageType="my:LoanResponseMessage" name="outputVariable"/>
       <variable messageType="imp1:outMessage" name="MyMathOutput"/>
       <variable messageType="my:LoanRequestMessage" name="inputVariable"/>
       </variables>
       <sequence>
       <receive createInstance="yes" name="receiveInput" operation="requestLoan"
       partnerLink="client" portType="my:LoanRequest" variable="inputVariable"/>
       <assign name="assign">
       <copy>
       <from expression="500"/>
       <to part="aNum1" variable="MyMathInput"/>
       </copy>
       <copy>
       <from part="form" query="/my:LoanRequestForm/amount"
       variable="inputVariable"/>
       <to part="aNum2" variable="MyMathInput"/>
       </copy>
       </assign>
       <invoke inputVariable="MyMathInput" name="invokeMyMath" operation="min"
       outputVariable="MyMathOutput" partnerLink="MyMath"
       portType="imp1:MyMathPortType"/>
       <assign name="assign">
       <copy>
       <from part="aNum" variable="MyMathOutput"/>
       <to part="result" query="/my:LoanRequestResult/amount"
       variable="outputVariable"/>
       </copy>
       <copy>
       <from part="form" query="/my:LoanRequestForm/customerId"
       variable="inputVariable"/>
       <to part="result" query="/my:LoanRequestResult/ref"
       variable="outputVariable"/>
       </copy>
       </assign>
       <invoke inputVariable="outputVariable" name="callbackClient"
       operation="responseLoan" partnerLink="client"
       portType="my:LoanRequestCallback"/>
       </sequence>
      </process>
      
      
      LoanRequest.wsdl
      <?xml version="1.0" encoding="UTF-8"?>
      <definitions targetNamespace="http://learning/LoanRequest"
      xmlns="http://schemas.xmlsoap.org/wsdl/"
      xmlns:my="http://learning/LoanRequest"
      xmlns:imp1="http://learning/MyMath"
      xmlns:xsd="http://www.w3.org/2001/XMLSchema"
      xmlns:bpws="http://schemas.xmlsoap.org/ws/2003/03/business-process/"
      xmlns:plnk="http://schemas.xmlsoap.org/ws/2003/05/partner-link/"
      name="LoanRequest">
       <import location="LoanRequest_Import.wsdl"
       namespace="http://learning/LoanRequest"/>
       <import location="MyMath.wsdl" namespace="http://learning/MyMath"/>
       <plnk:partnerLinkType name="LoanRequest">
       <plnk:role name="LoanRequestProvider">
       <plnk:portType name="my:LoanRequest"/>
       </plnk:role>
       <plnk:role name="LoanRequestRequester">
       <plnk:portType name="my:LoanRequestCallback"/>
       </plnk:role>
       </plnk:partnerLinkType>
       <plnk:partnerLinkType name="MyMathPartnerLinkType">
       <plnk:role name="MyMathPartnerRole">
       <plnk:portType name="imp1:MyMathPortType"/>
       </plnk:role>
       </plnk:partnerLinkType>
      </definitions>
      
      
      LoanRequest_Import.wsdl
      <?xml version="1.0" encoding="UTF-8"?>
      <definitions targetNamespace="http://learning/LoanRequest"
      xmlns="http://schemas.xmlsoap.org/wsdl/"
      xmlns:my="http://learning/LoanRequest" xmlns:imp1="http://learning/MyMath"
      xmlns:xsd="http://www.w3.org/2001/XMLSchema"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://schemas.xmlsoap.org/wsdl/
      http://schemas.xmlsoap.org/wsdl/" name="LoanRequest">
       <import location="MyMath.wsdl" namespace="http://learning/MyMath"/>
       <types>
       <schema targetNamespace="http://learning/LoanRequest"
       xmlns="http://www.w3.org/2001/XMLSchema">
       <complexType name="LoanRequestFormType">
       <sequence>
       <element name="customerId" type="xsd:string"/>
       <element name="amount" type="xsd:int"/>
       </sequence>
       </complexType>
       <complexType name="LoanRequestResultType">
       <sequence>
       <element name="ref" type="xsd:string"/>
       <element name="amount" type="xsd:int"/>
       </sequence>
       </complexType>
       </schema>
       </types>
       <message name="LoanRequestMessage">
       <part type="my:LoanRequestFormType" name="form"/>
       </message>
       <message name="LoanResponseMessage">
       <part type="my:LoanRequestResultType" name="result"/>
       </message>
       <portType name="LoanRequest">
       <operation name="requestLoan">
       <input message="my:LoanRequestMessage" name="request"/>
       </operation>
       </portType>
       <portType name="LoanRequestCallback">
       <operation name="responseLoan">
       <input message="my:LoanResponseMessage" name="response"/>
       </operation>
       </portType>
      </definitions>
      
      
      MyMath.wsdl
      <?xml version="1.0" encoding="UTF-8"?>
      <definitions targetNamespace="http://learning/MyMath"
      xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:my="http://learning/MyMath"
      xmlns:xsd="http://www.w3.org/2001/XMLSchema"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://schemas.xmlsoap.org/wsdl/
      http://schemas.xmlsoap.org/wsdl/">
       <message name="inMessage">
       <part name="aNum1" type="xsd:int"/>
       <part name="aNum2" type="xsd:int"/>
       </message>
       <message name="outMessage">
       <part name="aNum" type="xsd:int"/>
       </message>
       <portType name="MyMathPortType">
       <operation name="min">
       <input message="my:inMessage"/>
       <output message="my:outMessage"/>
       </operation>
       <operation name="max">
       <input message="my:inMessage"/>
       <output message="my:outMessage"/>
       </operation>
       </portType>
      </definitions>
      
      
      bpel-definition.xml
      <?xml version="1.0" encoding="UTF-8"?>
      <bpelDefinition location="LoanRequest.bpel"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://jbpm.org/bpel
      http://jbpm.org/bpel/bpel_definition_1_0.xsd" xmlns="http://jbpm.org/bpel">
       <imports>
       <wsdl namespace="http://learning/LoanRequest" location="LoanRequest.wsdl"/>
       </imports>
      </bpelDefinition>
      
      
      wscompile-cfg.xml
      <?xml version="1.0" encoding="UTF-8"?>
      <configuration xmlns="http://java.sun.com/xml/ns/jax-rpc/ri/config">
       <wsdl location="wsdl/service.wsdl"
       packageName="learning.loanrequest">
       <namespaceMappingRegistry>
       <namespaceMapping namespace="http://learning/LoanRequest"
       packageName="learning.loanrequest"/>
       </namespaceMappingRegistry>
       </wsdl>
      </configuration>
      


      Thank you very much. ^^
      Roy

        • 1. Re: Asynchronize BPEL process and external partnerLink
          aguizar

          The unit test in the ATM example invokes the service provided by the process synchronously. The process can't invoke it back, tough, because it isn't a service.

          You need to deploy a service which implements the port type LoanRequestCallback and let the BPEL application know of its existence. For this purpose, register it in the definition catalog section of the bpel application descriptor, as described in section 6.2 of the ATM example guide.

          An alternative approach is to have the invoking service annotate the SOAP messages with WS-addressing headers. Among others, these headers carry these details:
          destination
          source endpoint
          reply endpoint
          fault endpoint
          The latter two tell where to deliver output and fault messages respectively. WS-A makes it possible to offer a caller-ID feature. The service catalog would still needed to retrieve the associated WSDL definitions, as the endpoint addresses alone do not convey enough information to invoke a service.

          However, jBPM BPEL is not yet aware of WS-Addressing headers :-( It is an upcoming feature.