# Step 2: Specify How the Process is Started

In this step, you specify how your business process is started.

As Web services, business processes expose their functionality through methods, which clients invoke to make requests. You can also create Process controls from business processes. In the case of Process controls, other resources can interact with your business process via the controls interface. You learn more about Process controls in Part II of this tutorial.

In this step, you design the Start node in your business process to receive a Request for Quote message from a client—the receipt of this message is the trigger that starts the business process.You also create a variable to hold the incoming Request for Quote message.

In the Design View, the interactions between a business process and a client application are represented by Client Request and Client Response nodes. In this case, you add a Client Request node to your business process and subsequently create the code on this node to handle the receipt of a message from a client.

Complete the following tasks to design the Client Request node that starts your business process:

- To Create a Start Node in Your Business Process
- To Design Your Client Request Node

To Create a Start Node in Your Business Process

1. On the Application pane, double-click RequestQuote.jpd. Your RequestQuote business process is displayed in the Design View.

You must add a node to this Start node to define the start method for your business process.

2. Double-click the empty Starting Event target on the Start node to display the Start node builder.

The node builder displays with the possible start methods.

3. In the node builder, select Invoked via a Client Request.
4. Click the X in the top right-hand corner. The node builder closes and the empty node that was associated with the Start node is now populated with a Client Request node.

To Design Your Client Request Node

Designing your Client Request node includes creating a method and parameters that your client uses to trigger the start of your business process, and designing the logic for handling the receipt of a request from a client.

1. Rename the Client Request node. To do so, click the Client Request node and press F2. Enter Client Requests Quote as the name to replace Client Request for the node. Press Enter. Your business process should now resemble the following figure:

2. In Design View, double-click the Client Requests Quote node. The node builder is invoked.

Note: Node builders provide a task-driven user interface that helps you design the communication between a business process and its clients and other resources. To access the node builder for any node, double-click the node in the Design View—a node builder specific for the node you selected is displayed in-line in your business process.

As shown in the preceding figure, the node builder for a Client Request node displays the following tabs to guide your design of the communication between a client and the business process: General Settings and Receive Data.

- To Specify General Settings
- To Specify Receive Data

To Specify General Settings

The following steps describe how to specify the method exposed by your business process to clients—clients invoke this method to start and make requests on your business process.

1. In the Method Name field on the General Settings tab, change the default method name from clientRequest to quoteRequest.

Note: When you make your business process available as a service, the name you assign to a method on a Client Request node is the name of the method that is exposed via the Web Services Description Language (WSDL). In general, it is recommended that you define a name that is representative of the service offered by your business process.

2. Specify a data type for the parameter to your quoteRequest method:

1. Click Add on the General Settings tab. A panel, which shows the data types you can use is displayed:

The Request for Quote message from clients is an XML message. Therefore, we are concerned with XML Types at this node.

2. If necessary, select XML. The panel is populated with a list of XML Schema files (Typed XML) and a list of Untyped XML objects available in your project.

Note: The XML Schemas you need as you build the Quote Request business process in this tutorial are provided in the myapplications\Tutorial_Process_Application\Schemas folder, where myapplications represents the location where you created your tutorial application. The Schemas provided include QuoteRequest.xsd, PriceQuote.xsd, AvailQuote.xsd, Quote.xsd and a system Schema: DynamicProperties.xsd.
For XML Schemas to be available to the services in your application, they must be located in a Schemas project. Schemas projects are represented the Application pane as folders in the Application folder. To learn about creating Schemas projects in your applications and importing XML Schemas, including system Schemas, into your application, see Importing Files into the Schemas Project.
In this step, we use an XML Schema, specifically QuoteRequest.xsd, to specify the structure of documents that clients can send to start your business process.

3. In the list of XML Types, click the + associated with QuoteRequest.xsd.

A graphical representation of the XML Schema defined by QuoteRequest.xsd is displayed in the node builder pane.

4. Click the quoteRequest node. (It represents the parent element in your XML document.) The Type field is populated with the XML type: org.example.request.QuoteRequestDocument.

5. In the Name field, replace the default parameter name (x0) with requestXML.

3. Click OK. The parameter specifications you made (parameter type is QuoteRequestDocument, parameter name is requestXML) is displayed in General Settings tab in the node builder.

This step completes the specification of the method exposed to clients by your business process. Messages from clients are expected to be typed XML. That is, the messages received from clients must contain XML that is valid against an XML Schema (in this case, QuoteRequest.xsd).

Note: Example XML messages (QuoteRequest.xml and QuoteRequest_a.xml) that can be received from a client are provided in the testxml folder in your project. You use them later in the tutorial to test your business process.

The General Settings tab is updated to indicate that you successfully completed the specification of a method name and parameters: indicates that a task is complete; indicates that a task is not complete.

To Specify Receive Data

1. Click the Receive Data tab, which allows you to specify a variable that receives a Request for Quote message from a client that is assigned at run time. By default, the Receive Data tab opens on the Variable Assignment panel.

Note: Receive Data tabs have two modes:

- Variable Assignment—Use this mode when you want to assign the data received from the client to a variable of the same data type.
- Transformation—Use this mode when you want to create a transformation between the data assigned to a variable and that expected by the method parameter.

Note: Note that it is also possible to assign typed Non-XML (MFL) data directly to XML variables in the Receive Data tabs; no transformation is necessary. A discussion of Non-XML (MFL) data is outside the scope of this tutorial. To learn about MFL files and the assignment of the data to business process variables, see Business Process Variables and Data Types.

In this case, we use the Variable Assignment mode because we want to assign the XML message received from the client directly to a variable of the same data type. In subsequent steps, you create a variable of typed XML (QuoteRequestDocument) to which your process assigns the incoming Request for Quote from clients.

2. Under Select variables to assign, click the arrow and select Create new variable...

The Create Variable dialog box is displayed.

3. In the Create Variable dialog box:

1. In the Variable Name field, enter requestXML.
2. In the Select Variable Type field, in the list of XML Types, select the quoteRequest element under QuoteRequest.xsd.

The Variable Type field is populated with org.example.request.QuoteRequestDocument.

3. Click OK. Your new variable is created and displayed in the Receive Data tab.

Note: The requestXML variable is also listed as an XML variable in the Data Palette.

Both tabs in the node builder (General Settings and Receive Data) are marked complete .

4. Click the X in the top right-hand corner. The Client Requests Quote node builder closes.

In Design View, note that the completeness icon associated with the Client Requests Quote node changed from to indicating that the design of the node is complete.

5. From the Workshop menu, select File —> Save All.

Related Topics

Components of Your Application

Designing Start Nodes

Working With Data Types

Interacting With Resources Using Controls

Calling Business Processes