<?xml version="1.0" encoding="UTF-8"?>
<process name="HelloWorld" targetNamespace="http://jbpm.org/examples/hello"
  xmlns="http://schemas.xmlsoap.org/ws/2003/03/business-process/"
  xmlns:tns="http://jbpm.org/examples/hello"
  xmlns:bpel="http://schemas.xmlsoap.org/ws/2003/03/business-process/"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://schemas.xmlsoap.org/ws/2003/03/business-process/
                      http://schemas.xmlsoap.org/ws/2003/03/business-process/">

  <partnerLinks>
    <!-- establishes the relationship with the caller agent -->
    <partnerLink name="caller" partnerLinkType="tns:Greeter-Caller" myRole="Greeter" />
  </partnerLinks>

  <variables>
    <!-- holds the incoming message -->
    <variable name="request" messageType="tns:NameMessage" />
    <!-- holds the outgoing message -->
    <variable name="response" messageType="tns:GreetingMessage" />
  </variables>

  <sequence>
    
    <!-- receive the name of a person -->
    <receive operation="sayHello" partnerLink="caller" portType="tns:Greeter"
      variable="request" createInstance="yes" />
      
    <!-- compose a greeting phrase -->
    <assign>
      <copy>
        <from expression="concat('Hello, ', 
                          bpel:getVariableData('request', 'name'), 
                          '!')" />
        <to variable="response" part="greeting" />
      </copy>
    </assign>
    
    <!-- reply with the greeting -->
    <reply operation="sayHello" partnerLink="caller" portType="tns:Greeter"
      variable="response" />
  </sequence>

</process>