From UML to BPEL

Source: Internet
Author: User
Tags xmi file websphere application server wsdl
This document describes a new tool released on the alphaWorks website, emerging technologies Toolkit version 1.1 (ettk), which uses the Unified Modeling Language (UML) define the process and generate the relevant BPEL and WSDL documents to implement the process. This kind of performance is used to highlight some of the advantages of the omgs model-driven architecture (MDA): it improves the Abstraction Level in the development process, so as to achieve higher productivity and better quality, isolated from fundamental technological changes.

So many XML...

With the emergence of a Service-Oriented Architecture (SOA), application development has undergone a thorough change. This architecture combines XML-based standards, such as WSDL, Simple Object Access Protocol (SOAP), unified description, discovery and Integration Protocol (UDDI), and current BPEL. However, when you can do more, the size and complexity of development tasks have been improved, and developers will find that they are addicted to documents and syntaxes, and lost their main goals. In addition, the goals of developers are changing, and standards are also evolving. Therefore, in order to quickly adopt web services, developers are looking for answers to complicated, efficient, and technical changes.

The BPEL ing tool from UML to BPEL can obtain the process model developed with UML tools (such as IBM Rational xde or rose, they can also be converted to the correct BPEL and WSDL documents to implement this process. Emerging technologies Toolkit version 1.1 (ettk) is an environment for testing interesting new technologies, and now has two formats: autonomic and WebServices. This article focuses on WebServices.

What is BPEL?

BPEL provides XML annotations and semantics for specifying web service-based business process behaviors. The BPEL4WS process is defined using the partner's interaction mode. Partners can provide services to the process, request services from the process, or participate in two-way interaction of the process. BPEL orchestrates web services by specifying the order, which is of far-reaching significance for the call of Service sets. BPEL also allocates partner responsibilities for each service. You can use it to specify the partner's public interface and executable process description.

BPEL 1.1 is the latest version of this specification. In addition to clarifying terms, it also allows a better range of variables and additional event handlers. For the latest version of this specification and the introduction of BPEL, see the first two links.

 

Why use UML?

UML is an OMG standard that provides a visual modeling representation that is very effective for designing and understanding complex systems.

UML has the following common advantages: it is a well-known object-oriented (object-oriented, OO) Modeling Notation, it has easy-to-understand graphical representation and a rich set of semantic sets to capture key features of the OO system. UML is widely used in object-oriented software development. It is also commonly used in customized, component-based software development, business process modeling, and system design. This allows most UML experiences to be applied to mature web service technologies.

Extended UML

It is necessary to extend or customize the features of UML for MDA. You can customize UML to support system modeling. Such systems need to be completely or partially deployed to the Web service infrastructure. This article mainly introduces the template (stereotypes ). A template (stereotypes) is a method for classifying model elements. For example, if you have a class that represents a customer, you can add<<entity>>The template (stereotypes) represents a Data Object (maybe entity bean ). This information helps people make the model readable and can even be used to change the icons that represent classes in case tools (such as Rational Rose. However, in this case, you can use it to guide model translation. Remember, you can add the template (stereotypes) to more elements in the UML model. You can also combine these templates in the profile ). To represent a specific domain of interest, the UML configuration file (profiles) is used to define an extension set for basic UML. For example, the configuration files defined for CORBA and data modeling ). The configuration file defines the UML elements to be used, how to expand them, and the good rules that constrain the Element Set (Well-formedness rules).

The following section describes a UML profile that supports modeling by constructing a set of Semantic Structures corresponding to BPEL4WS (Web Service Business Process Execution Language. It also describes the BPEL4WS ing. the BPEL4WS ing can automatically generate a web service product (BPEL, WSDL, and XSD) from the UML model suitable for the configuration file ).

The following sections describe the actual BPEL example and UML configuration file (profile), and focus on key concepts.

 

UML Profile for automated business processes)

This section uses an example to introduce the subset of the UML configuration file, which defines a simple loan approval process. In this example, you will find the converter in the README document of ettk. It can be summarized as follows:

"When receiving a loan request, compare the value of the request with the value (10000. If the number of requests is small, the assessor service is called; otherwise, the approver service is called. If the accessor deems the request highly risky, it will also be passed to the approver. When the approver is completed or the accessor is accepted, the approval information will be returned ."

The BPEL process is stateful and contains instances. Therefore, this process is implemented as a loanapproval process in the bpel. For each actual loan application being processed, there will be an instance in the loanapproval process. Each instance uses a BPEL variable to capture its own State. In the UML configuration file, the process is represented<<Process>>Template Class. Class attributes correspond to the process state (containers in BPEL4WS 1.0 terms, or variables in BPEL 1.1). Figure 1 shows the UML class that represents the loan approval process.

You can use the activity diagram to clearly describe the class behavior. Figure 2 shows an activity diagram of the loan approval process. For example,invokeAssessorThe activity is displayed as a rectangle with rounded corners. The executed operation is displayed as the entry condition of the activity. For example,riskAssessment(A variable) is set to check the service results. The customer, assessor, and approver communication partners in the process are represented by UML partitioning (also used as a swimming pool. Each partition shows activities that send or receive information to partners. The arrow indicates the sequence of activities executed by the process. Note that the assingment activity is not put into a partition; it depicts the activity that occurs in its own process and does not require external services.

The reply activity returns a response to the customer to complete the process. Each activity has a descriptive name and an input activity to refine the execution of the activity.

 

Map to BPEL4WS

The UML configuration file for automated business processes indicates that a complete executable BPEL product can be generated from the UML model. Table 1 outlines the ing from the configuration file to the BPEL, covering the configuration file subset described in this article.

Configuration file component
BPEL4WS Concept

<Process> class
BPEL Process Definition

<Process> activity diagram of a class
BPEL activity level

<Process> class attributes
BPEL variable

Layered structure and control flow
BPEL sequence and process activity

<Receive>, <reply>, and <invoke> Activity
BPEL Activity

Listing 1 (because of the layout space, a lot of detailed code is omitted here) shows the reduced version of The BPEL document, which is generated by the loan approval example described in this article.

List 1. Extract from the BPEL list

<process name="loanApprovalProcess" ...>  <variables>    <variable name="request"                messageType="loandef:creditInformationMessage"/>    <variable name="riskAssessment"                messageType="asns:riskAssessmentMessage"/>    ...  </variables>  ...   <flow>      <receive name="receive1" partner="customer"              portType="apns:loanApprovalPT"              operation="approve" variable="request"             createInstance="yes">      <source linkName="receive-to-assess"              transitionCondition=              "bpws:getVariableData('request', 'amount')<10000"/>      <source linkName="receive-to-approval"              transitionCondition=              "bpws:getVariableData('request', 'amount')>=10000"/>    </receive>    <invoke name="invokeAssessor" partner="assessor"             portType="asns:riskAssessmentPT"             operation="check"            inputVariable="request"              outputVariable="riskAssessment">      <target linkName="receive-to-assess"/>      <source linkName="assess-to-setMessage"               transitionCondition=              "bpws:getVariableData('riskAssessment', 'risk')='low'"/>      <source linkName="assess-to-approval"               transitionCondition=              "bpws:getVariableData('riskAssessment', 'risk')!='low'"/>    </invoke>    <assign name="assign">      <target linkName="assess-to-setMessage"/>      <source linkName="setMessage-to-reply"/>      <copy>        <from expression="'yes'"/>        <to variable="approvalInfo" part="accept"/>      </copy>    </assign>    ...    <reply name="reply" partner="customer" portType="apns:loanApprovalPT"            operation="approve" variable="approvalInfo">      <target linkName="setMessage-to-reply"/>      <target linkName="approval-to-reply"/>    </reply>  </flow></process>

You can find the complete configuration file link in the references.

 

UML-to-BPEL ing validators

From IBM alphaWorks, you can obtain the technical validators as part of ettk, which support end-to-end scenarios from UML tools (such as rational xde) to BPEL4WS Runtime (bpws4j. The ing implementation is built as the Eclipse plug-in, which uses the industrial standard file format exchanged by the UML Model (XMI) as the input. BPEL4WS products (artifact) are generated together with the required WSDL and XSD products.

Let's take a look at the validators. First, install the required prerequisites. The ettk page displays the relevant details (see the reference material download link ). To sum up, you need the following resources:

  • Rose or xde (xde v2003 is used in this article)
  • Eclipse 2.0 + or WebSphere Studio Application Developer (wsad) 5.0 +
  • WebSphere Application Server (WAS) 5.0 + or Apache Tomcat 4.1.24 +
  • The ettk itself (including bpws4j ).

Assume that you already have the following appropriate environment.

The validators are generated with a set of sample documents in different scenarios, such as loan approval or purchase order processes. There are two types of sample documents: one is a model document that can be opened and modified by rose or xdeuml, and the other is an XML document that contains the XMI version of the UML model, this document can be output through rose or xde. In Figure 3, we can see the corresponding models in Rose or xde, or the XMI output models of these tools.

Figure 3 using a UML activity diagram shows the entire process of the conversion document. Is UML useless? A box represents a product (usually a document), while an ellipse represents an operation or activity. The main stages are:

  • Build a UML Model and export it to XMI (using rose or xde)
  • Generate BPEL, WSDL, and XSD documents
  • Deploy and run these documents -- test during bpws4j run time.

Build and output a UML Model

If you have rose without xde, you can open one of the UML documents (. MDL or. MDX). In this article, you have seen these examples through loan approval.

In Figure 4uml, the model is output to XMI. You must use xde v2003 or an updated version. Note that the benefit of this method is that you are using a general purpose, without modifying the UML tool and the standard extension mechanism of UML to build and output process definitions.

Once the model is executed, click the file --> export menu and select XMI export to output it, as shown in figure 4.

Generate the BPEL and WSDL documents

Create a Java project in eclipse (or WebSphere Application Developer (IE), and then import the XMI document you created earlier (or use the XMI sample document provided by ettk ). Finally, select the XMI file and right-click the menu and select "generate BPEL from UML", as shown in Figure 5.

The following provides an opportunity for you to change different prefixes. You need to make improvements to match your settings. If you happen to use ettk for installation, the default value does not need to be modified, see Figure 6.

After you click the "finish" button, many documents will be displayed in the project, including the main BPEL and WSDL documents, loanassessor and loanapprover services, and data definition WSDL documents.

Test

In this case, the generated documents should be ready for deployment. You can deploy Apache Tomcat in this article, but you can also use WebSphere Application Server.

Navigate to the BPEL4WS deployment Panel (address: http: // localhost: 8080/bpws4j/admin/index.html )), enter the corresponding WSDL document (loan approvalprocess) in the corresponding fields of the main service. (that is, processorder. as shown in figure 7.

Click the "continue deployment" button to insert all documents required by different roles in the process. In this example, there are two special tasks: loanassessor and loanapprover.

Once the deployment process is completed (see figure 8), the running example is the same as the bpws4j example: Call the loanapprovalsample script corresponding to your operating system:

LoanApprovalSample [soap-address] first-name last-name amount

For example,

LoanApprovalSample http://localhost:80/bpws4j/soaprpcrouter John Doe 10

According to the UML activity diagram, we can know that the value 10000 is important!

 

Reflection

This section describes the UML configuration file for automated business processes with a UML-to-BPEL converter. The configuration file allows developers to use common UML skills and tools to develop Web Service Business Processes Based on BPEL4WS. This method combines service-oriented BPEL4WS components into a comprehensive system design that utilizes the existing software engineering methods. In addition, ing from UML to BPEL4WS allows you to use model-driven development methods to automatically generate executable BPEL4WS processes from UML models.

This method focuses on how the concept of MDA can be applied to other fields and abstract to a higher level. This method allows developers to isolate technology changes.

There are several different cases. In each case, this method is beneficial:

  • In the first case, block the changes to the technology version used in the project. You can (and have already) change the version of BPEL. If the semantics used by the process does not change fundamentally, You can regenerate the implementation without the intervention of developers. This conversion technology can also be used to protect developers' investment in developing UML models at the beginning: when a new version of UML is available (for example, upgrading a version from 1.4 to 2 ), the UML model itself can also be converted.
  • In the second case, you can generate a UML configuration table and use it to generate other process implementations, such as bpml.
  • The third method is to generate multiple technical products (artifact) from a single model ). In this example, it includes the BPEL and WSDL, but cannot generate non-XML output, such as Java output.
  • Finally, the transformation is bidirectional-in this example, there is a reverse ing to support the import of the existing BPEL4WS and WSDL products (artifact), as well as the synchronization of BPEL4WS and WSDL products (artifact, changes made by one party can be reflected by the other.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.