If you need to communicate to other processes and services, you can use service tasks. You have added a service task (Save Quote)
while modeling as a Process Analyst, as you were aware at that point of time that your process will need to invoke a service. Now, as a Process Developer, you can implement the necessary services. You can use the service task to invoke other BPMN processes, BPEL processes, SOA service adapters, and Mediators that are exposed as services.
In our example, the SaveQuote
activity is a service task. It represents an automated (or system) invocation step.
The service task has similar behavior to the Send and Receive task pair and the Message throw and Catch event pair. The primary difference is that the service task is used to invoke processes and services synchronously.
You can use a composite editor to create services, and the SOA resource palette lists the type of service components and adapters you can configure. You will find that you have many options in the component palette. For example, you could define a BPEL Process Service if you want to call a BPEL Process, a Database Adapter service if you want to write to a database, or even a File Adapter service if you want to write to a file on the disk.
You can even find a Web Service Adapter, which is generic it's for web services that are not already listed. You can use a wizard to configure a Web Service adapter from scratch. You need to define a service and bind it to the activity. Configuration of the service varies according to which kind of service is selected. Then you need to map data input and output. Hence the steps can be summed up as follows:
You will be defining a service for the Save Quote
activity, which will save the quote
payload to a local filesystem. The Save Quote service task is bound to a File Adapter Service
This will open the FILE Adapter Configuration Wizard.
WSDL is used to define the adapter interface. This WSDL is generated by the operation and schema, which we will choose later in this wizard. By choosing this option, you are directing WSDL to define an adapter interface that will be generated later.
QuoteOutputFileLoc
and give a File Naming Convention:Quote_%SEQ%.xml.
You can find the SaveQuote External service to verify its creation.
Click on the browsing icon to the right to search for the service:
Go to the Data Associations section. You can check the Use Associations to perform input-output mappings.
quote
Data object from the right-hand panel to the Inputs area and click OK.When the service task invokes a process or service, the token waits at the service task until a response is returned. After the response is received, the token continues to the next sequence flow in the process. You use service tasks to invoke synchronous operations in services and BPMN processes. By synchronous, we mean that when the BPMN service engine runs a service task, it invokes the operation specified in the service task and waits for a response. In this case, data for quote
is provided to the SaveQuote
file service, which writes it to a file location.
Assigning the outcome of an Interactive task to Data objects Interactive tasks come with outcomes. You have defined these outcomes when you configured the Human Task Implementation artifact. Like you have set Submit as the outcome for Enter Quote Human Task, you have to assign these outcome values to Data objects to be used in the process, as shown in the following screenshot:
You can remember that you have already created BusinessAnalystOutcome, approveDealOutcome
, and approveTermsOutcome
as a Data object in Chapter 1, Process Modeling, to hold values while you modeled the process. You will assign the outcome of the Business Analyst Review
activity to the BusinessAnalystOutcome
Data object, and similarly you will assign the outcomes of the Approve Deal
and Approve Terms
activities to the approveDealOutcome
and approveTermsOutcome
Data objects, respectively.
Approve Deal
and Approve Terms
activities too.approveDealOutcome
Data object to the outcome of the Approve Deal activity and click OK twice to return to the designer:approveTermsOutcome
Data object to the outcome of the Approve Terms activity, and click OK twice to return to the designer.When the token returns back to the process from the Human Task, it brings the outcome with it. These outcomes will be assigned to the Data objects, based on the Data association defined in the properties of the activities.
You created a script task in Chapter 1, Process Modeling, to initialize values. You have created a process Data object, BusinessAnalystReviewRequired
, and assigned the values of false ()
in the section Changing the Value of Data Objects in Your Process in Chapter 1, Process Modeling. These values will be required while conditionally branching from the Gateways.
18.117.99.71