Guide to Building Business Processes

     Previous  Next    Open TOC in new window  Open Index in new window  View as PDF - New Window  Get Adobe Reader - New Window
Content starts here

Business Process Variables and Data Types

In the Design view, the Variables tab displays the variables associated with the Java class that constitutes your business process. All business process variables are global to the business process instance.

This section describes business process variables and their data types. It includes the following topics:

Creating Variables

There are two ways of creating variables for your business process. Variables can be created in the Data Palette by clicking Menu tab on the Data Palette menu and scroll down the list, select AddArrow symbola Variable... or they can be created in the node builder when you are configuring the Send Data or Receive Data section of a Client Request, Client Request with Return (Start Node only), Client Response, Subscription (Start Node only), Control Send, Control Send with Return, or Control Receive node for your business process nodes. Whichever method you choose, you can always access your variables from the Data Palette after they are created. When you select a variable in the list on the Data Palette, its properties are displayed in the JPD Configuration view.

Before you can create an XML variable of a particular XML Schema type, you must first import the XSD file that contains the XML Schema into the WebLogic Integration schemas project

Before you can create a non-XML variable of a particular non-XML type, you must first import the MFL file that contains the schema for the non-XML type into the WebLogic Integration schemas project.

Before you can create a variable of a Java class, the Java class file must be available in the Workshop project.

To Create a New Variable in the Data Palette

You can create variables using the Add a Variable... option on the Menu tab. To learn how to create variables in the node builder, see To Create a New Variable in the Node Builder.

  1. If the Data Palette pane is not visible in BEA WorkSpace Studio, choose Window > Show View > Data Palette from the menu bar.
  2. The Data Palette, which contains a Menu drop-down button, is displayed in the BEA WorkSpace Studio.

  3. In the Menu tab, scroll down the list and click Add a Variable..., the Create Variable dialog box is displayed, as shown in Figure 19-1.
  4. Figure 19-1 Create Variable


    Create Variable

    A description of the possible variable types options are as follows:

    • Simple Types
    • Lists Java primitive and classes data types.

    • XML Types
    • Lists the XML Schemas that are available in your business process project and the untyped XMLObject and XMLObjectList data types.

    • Non-XML Types
    • Lists the Message Format Language (MFL) files available in your business process project and the untyped RawData data type. WebLogic Integration uses a metadata language called Message Format Language (MFL), based on XML, to describe the structure of non-XML data. Every MFL file available in your project is listed in Non-XML Types. Note that an XML Schema representation of each MFL file is built by BEA WorkSpace Studio and is also available in the XML Types listing.

      For more detailed descriptions of the data types, see Working with Data Types .

  5. From the menu, select the appropriate variable types from the selected option: Simple, XML, or NonXML.
  6. In the Variable Name field, enter a name for your variable.
  7. In the Type Name field, select or in the Type Name field, enter a variable type:
    • For a Simple class type variable, enter the full package name of the class in the Type Name field. For example, for a class named Book in the package named library, enter: library.Book. (For Java simple types, see step 7.)
    • For all other all variable types, select a variable type from the available list.
    • The Type Name field is populated with the variable type you selected.

  8. If you want to assign a default value to your variable, enter it in the Default value field.
  9. If your variable is a Simple type and you want it to be a constant that cannot be updated, select Declare as constant, then enter the constant value in the Default value field. This will create the variable as static and final.
  10. Click OK to create the new variable.
  11. The Variables tab in the Data Palette is populated with the variable you created; the name and type of the variable is displayed. When you select a variable in the list, the variable properties are displayed in the Properties view.

To Create a New Variable in the Node Builder

You can create variables directly in the node builder while you are configuring a node’s Receive or Send Data tab.

  1. In the Receive or Send Data tab, select the Variables Assignment option if necessary.
  2. From the Select variables to assign: drop-down menu, click the arrow and select Create new variable.... The Create Variable dialog box is displayed.
  3. Note: The other fields in the dialog box are already populated with the variable types expected by the method you specified on the General Settings tab.
  4. In the Variable Name field, enter a name for your variable.
  5. If you would like to use a variable of a type other than what is expected by the method you specified on the General Setting tab:
    1. Select a variable type option for your variable:
    • Simple Types
    • Lists Java primitive and classes data types

    • XML Types
    • Lists the XML Schemas that are available in your business process project and the untyped XMLObject and XMLObjectList data types.

    • Non-XML Types
    • Lists the Message Format Language (MFL) files available in your business process project and the untyped RawData data type. WebLogic Integration uses a metadata language called Message Format Language (MFL), based on XML, to describe the structure of non-XML data. Every MFL file available in your project is listed in Non-XML Types. Note that an XML Schema representation of each MFL file is built by BEA WorkSpace Studio and is also available in the XML Types listing.

      For more detailed descriptions of the data types, see Working with Data Types.

      The Type Name field is populated with the variable type you selected.

  6. Select or enter a variable type:
    • For a Simple class type variable in the Type Name field enter the full package name of the class in the Variable type field. For example, for a class named Book in the package named library, enter: library.Book. (For Java simple types, see step 6.)
    • For all other all variable types, select a variable type from the available list.
    • The Variable type field is populated with the variable type you selected.

  7. If your variable is a Java simple type and you want it to be a constant that cannot be updated, select Declare as constant, then enter the constant value in the Default value field. This will create the variable as static and final.
  8. If you want to assign a default value to your variable, enter it in the Default value field.
  9. Click OK to create the new variable.
  10. The new variable you created is displayed in the Select variables to assign: drop-down menu in the node builder and is added to the Variables tab in the Data Palette; the name and type of the variable is displayed. When you select a variable in the list, the variable properties are displayed in the Properties pane.

To Convert Application Variable Data Types

The node builders support assigning typed data to untyped process variables, and untyped data to typed process variables in the following ways:

Related Topics

Deleting Variables

Working with Data Types

Assigning MFL Data to XML Variables and XML Data to MFL Variables

Deleting Variables

To Delete a Variable

On the Data Palette, in the Variables tab, right-click the name of a variable and choose Delete from the drop-down menu. The variable is deleted from the Variables tab and from the source code for your application. To learn about variables in your source code, see Variables in Business Process Source Code.

Working with Data Types

The data types supported for your business process applications include:

XML Types

XML Schemas are an XML vocabulary that describe the rules that your business data must follow. XML Schemas specify the structure of documents, and the data type of each element and attribute contained in the document. XML Schema files have an XSD file suffix. You can create new schemas or import schemas into your schemas folder.

Note: To make the Schemas in your project available in your business process, you must place them in the schemas folder. To learn about the Application and project folders in the Design view, see Components of Your Application and Designing Your Application.

When you add XML Schemas to the Schemas folder in your business process project, they are compiled to generate XML Beans. In this way, BEA WorkSpace Studio generates a set of interfaces that represent aspects of your Schema. XML Bean types correspond to types in the XML Schema itself. XML Beans provides Java counterparts for all built-in Schema types, and generates Java counterparts for any derived types in your Schema. In addition when creating a variable or an xquery transformation method, xsd simple types would be mapped to java type names.

When you load an XML file that conforms to a particular XML Schema into an XML Bean generated from the Schema, you can access the XML as instances of the XML Bean types.

The XML untyped data includes:

XMLObject—This XML data type specifies untyped XML format data. In other words, this data type represents XML data that is not valid against an XML Schema.

XMLObjectList—This XML data type specifies a sequence of untyped XML format data. In other words, this data type represents a set of repeating elements of XML elements that are not valid against an XML Schema.

Tip for XML Object

When you assign an XMLObject variable or typed XML variable to an XMLObjectList, the XML document is added to the list (instead of directly assigning the variable).

Tip for Creating XML Schemas

When you create XML Schema definitions, which contain declarations for attributes, we recommend that you make these declarations inside, or local to, the element declarations. If you declare attributes at the top level of the XML Schema document (that is, immediately under the xsd:schema root), they must be qualified by a target namespace, if one exists. Consequently, for an XML instance document to be valid against such a Schema, the attributes within the XML document must be qualified with a namespace prefix associated with the target namespace. If you do not specify this prefix in an XML instance document, transformations or validations against the Schema fails.

Note: When creating a schema file supporting two imports with the same namespace, the XQuery Mapper ignores the second import.

Non-XML Types

WebLogic Integration uses a metadata language called Message Format Language (MFL), based on XML, to describe the structure of (typed) non-XML data. The Format Builder tool creates and maintains metadata as a data file, called an MFL document.

Note: When you create MFL files for use in your business process project, to make them available in your application, you must add the files to your schema folder. To learn about the Application and project folders in the Design View, see Components of Your Application.

Every MFL file available in your project is listed in Non-XML Types in the Create Variable dialog box. However, an XML Schema representation of each MFL file is built by WebLogic Workshop. This XML Schema representation of your MFL data is available in the XML Types listing. In other words, you can work with every MFL file in your project in its non-XML data representation (in non-XML MFL format) and in its XML Schema representation (XML typed data). For example if you add an MFL file named mydata.mfl to your business process project, mydata.mfl.xsd is listed in Non XML Types, and the corresponding XML Schema representation, mydata.mfl, is listed in XML Types. Although you are provided with a typed XML version of your typed non-XML format, both types are not automatically populated. That is, if you receive data in a typed non-XML format and then assign it to a typed non-XML variable and you create a variable for the corresponding typed XML version, it will not automatically contain the data that is in the typed non-XML variable. You must use a transformation map to accomplish this.

Note: Non-XML variables are equivalent to Binary variables in prior versions of WebLogic Integration.

The non-XML type data also includes the RawData type that specifies non-XML data for which no MFL file exists and therefore no known schema.

Although both XMLObject and RawData are both untyped data types in WebLogic Integration, the XMLObject data type is still XML and therefore has a structure that can be parsed. RawData is just a stream of data that has no known structure. Therefore, you cannot do things like use a RawData parameter in a XQuery expression or in a transformation method.

RawData type supports the following file type:

Simple Types

Contains the following Java data types:

Primitive Data Types—boolean, byte,char, double, float, int, long, and short.

Classes—Variables can be created from the Java classes in the current project. However, the Java classes available in the project are not listed in the Select variable to assign pane in the node builders. You must explicitly specify the Java class in the Type Name field as described in the following sections: To Create a New Variable in the Data Palette and To Create a New Variable in the Node Builder.

Java class variables can be used in business processes without any conversion. When you use Java classes in data transformations, WebLogic Integration converts the Java class into an internal XML Schema representation of the Java class file. The fields of Java class that cannot be converted to an XML Schema type are ignored.

Related Topics

Validating Schemas

Variables in Business Process Source Code

Assigning MFL Data to XML Variables and XML Data to MFL Variables

As described in Non-XML Types, an XML Schema representation of each MFL file in your application is built by BEA WorkSpace Studio. You can work with every MFL file in your project in its non-XML data representation (in non-XML MFL format) and in its XML Schema representation (XML typed data).

The variable assignment panes in the WebLogic Integration node builders treat MFL and their corresponding XML variables interchangeably, such that you can assign MFL data directly to the corresponding variables of type XML and XML data directly to the corresponding variables of type MFL; no data transformation is required.

In other words, the BEA WorkSpace Studio graphical design environment allows you to assign MFL data (that is passed into a business process from a client or a control) to strongly typed-XML variables directly, and to assign typed-XML data (sent from a business process to a client or a control) directly to MFL variables.

The node builders for the following nodes support the direct assignment of MFL data to XML variables and XML data to MFL variables: Client Request, Client Response, Control Send, Control Return, Control Send with Return. The example described in the following section describes a Client Request and a Client Response node; the steps are similar for any node.

Example Scenario—Requires Assignment of MFL Data to an XML Variable and Assignment of XML Data to an MFL Variable

Consider the following example:

Your business process is started by a request from a client. The request contains a purchase order document in MFL format, which is represented by an MFL file in a Schemas folder in your application.

To process the purchase order, your business process must first assign the MFL data to an XML variable (at a Client Request node). This XML variable is used in the processing of the purchase order at subsequent nodes. When the processing is complete, the business process sends a response document (from a Client Response node) to the client. The processed data (a price quote) is in XML format in your business process; because the client expects MFL data, a Client Response node assigns the XML data to a variable of type MFL before sending the response.

The business process in this scenario includes a Client Request node, a Client Response node, and the nodes between them (not described in this example) at which the processing logic is designed, as shown in Figure 19-2.

Figure 19-2 Processing Logic

Processing Logic

The following steps describe how to design the Client Request and Client Response nodes to do the MFL-to-XML and XML-to-MFL assignments required for the scenario described in this example.

To Design the Client Request Node
  1. In the Design View, double-click the Client Request node to invoke its node builder.
  2. In the General Settings tab, enter a name in the Method Name field to specify the name of the method on this Client Receive node (by default, the method is named clientRequest).
  3. In the General Settings tab, click Add to select the type and format of the data your Client Request node expects to receive from clients (that is, the data type for the method parameter). As shown in the following figure, the XML option is selected by default and XML Types are displayed. However, Non-XML Types and Simple Types are also available. To display the Non-XML and Java data types, select the NonXML or Simple tab on the panel, see Figure 19-3.
  4. Figure 19-3 Data Types


    Data Types

    Note: Every MFL file type in your project is listed in the Non-XML Types pane and every XML file type in your project is listed in the XML Types pane. In addition, because an XML Schema representation of each MFL file is built by WebLogic Workshop, an XML Schema representation of your MFL data is also available in the XML Types list.
  5. Select NonXML to display the Non-XML Types (Typed and Untyped) in your application, as shown in Figure 19-4.
  6. Figure 19-4 Non-XML


    Non-XML

  7. Click the + associated with the name of the MFL file that represents the type of the request the client makes to the business process. In this example, we click the + beside myMFLFile.mfl to display the root element MyMessageFormatMflObject.
  8. Click the root element—in this case, MyMessageFormatMflObject. The data type is displayed in the Type field.
  9. Enter a name for the method parameter in the Name field (in this example, we entered requestMFL), and click OK. The parameter type is displayed in the node builder:
  10. Click the Receive Data tab.
  11. The Receive Data tab allows you to define the variable to hold the data your business process receives from clients.

    The Client Sends field is populated with the parameter (or parameters) you specified on the General Settings tab. In this example, the data is of type MyMessageFormatMflObject:

  12. Create a new variable to which the data supplied in the method parameter will be assigned.
  13. To create a new variable, from the Select variables to assign drop-list, select Create new variable...

    The Create Variable dialog box is displayed with the fields already populated with the variable types expected by the method you specified on the General Settings tab.

  14. Select the XML option.
  15. Click the XML Schema that corresponds to the MFL data your business process expects to receive at this node. In this example, click the + beside myMFLFile.mfl.xsd to expand its structure.
  16. Click the root node of the schema. In this case, click MyMessageFormat. The Variable Type field is populated with the data type: mymflfile.MyMessageFormatDocument.
  17. In the Variable Name field, enter a name. In this example, we entered requestXML.
  18. Click OK. The node builder displays the assignment.
  19. Click Close, to close the node builder.
  20. To save your work, select FileArrow symbolSave.

The preceding steps described how to design a Client Request node to do a direct assignment of MFL data to an XML variable using the graphical design environment; no data transformation is required.

To Design the Client Response Node

For this example scenario, assume that some processing is done by the business process to process the purchase order request. As a result of the processing, the business process creates a typed-XML price quote document. The client expects a quote in MFL format (the quote message must be valid against an MFL schema named POquote.mfl). Therefore, the business process stores the price quote data in an XML variable that is valid against the XML schema associated with this MFL file (in this case named POquote.mfl.xsd)

Before sending the response to the client, the typed-XML price quote must be assigned to a typed non-XML (MFL) variable at the Client Response node. The following steps describe how to design the Client Response node for this XML-to-MFL scenario:

  1. In the Design View, double-click the Client Response node to invoke its node builder.
  2. In the General Settings tab, enter a name in the Method Name field to specify the name of the method (by default, the method is named clientResponse).
  3. In the General Settings tab, click Add to select the data type for the method parameter for your Client Request node.
  4. Click the + associated with the name of the XSD file that represents the type of the price quote created by the business process. In the example scenario, we click the + beside POquote.mfl.xsd to display the root element POQuote.
  5. Click the root element: in this case, POQuote. The data type is displayed in the Type field (poquote.POquoteDocument):
  6. In the Name field, enter a name for the parameter (in this example, we entered quoteXML), and then click OK. The parameter type is displayed in the node builder:
  7. Click the Send Data tab. The Client Expects field is populated with the parameter you specified on the General Settings tab. In the example, the method expects data of type poquote.POquoteDocument.
  8. Create a new variable to which the data supplied in the method parameter will be assigned. To create a new variable, from the Select variables to assign drop-list, select Create new variable.... The Create Variable dialog box is displayed and the fields are populated with the variable types expected by the method you specified on the General Settings tab.
  9. Select NonXML in the Select Variable Type pane to display the Non-XML types in your application.
  10. Click the MFL Schema that specifies to the MFL data your client expects to receive from the business process. In this example, click the + beside POQuote.mfl to expand its structure.
  11. Click the root node of the schema. In this case, click POquote. The Variable type field is populated with the data type: poquote.POquoteMflObject, as shown in the preceding figure.
  12. Enter a name in the Variable Name field. In this example, enter responseMFL.
  13. Click OK. The node builder displays the assignment.
  14. Click Close, to close the node builder.
  15. To save your work, click File > Save.

The preceding steps described how to design a Client Response node to do a direct assignment of XML data to its corresponding MFL variable using the graphical design environment; no data transformation is required.


  Back to Top       Previous  Next