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 WebLogic Workshop. 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 WebLogic Workshop 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 learn about importing XSD and MFL schemas into your application, see Importing Files into the Schemas Project.

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:

image

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 Java Types are also available. To display the Non-XML and Java data types, select the NonXML or Java options on the panel.
  4. image

    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.

    The following figure shows an example of the XML Types listing and the NonXML Types listing for an application which includes an MFL file named MyMFLFile.mfl:

    image

  5. Select NonXML to display the Non-XML Types (Typed and Untyped) in your application:
  6. image

  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. image

  11. Click the Receive Data tab.
  12. 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:

    image

  13. Create a new variable to which the data supplied in the method parameter will be assigned.
  14. 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.

    image

  15. In the Select Variable Type pane, select the XML option to switch the display to the XML types in your application.
  16. image

  17. 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.
  18. Click the root node of the schema. In this case, click MyMessageFormat. The Variable Type field is populated with the data type: mymflfile.MyMessageFormatDocument, as shown in the following figure:
  19. image

  20. In the Variable Name field, enter a name. In this example, we entered requestXML.
  21. Click OK. The node builder displays the assignment.
  22. image

  23. Click the X in the top right-hand corner to close the node builder.
  24. To save your work, select File —> Save.

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. image

  7. 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:
  8. image

  9. 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.
  10. image

  11. Create a new variable to which the data supplied in the method parameter will be assigned.
  12. 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.

  13. Select NonXML in the Select Variable Type pane to display the Non-XML types in your application.
  14. 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.
  15. image

  16. 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.
  17. Enter a name in the Variable Name field. In this example, enter responseMFL.
  18. Click OK. The node builder displays the assignment.
  19. image

  20. Click the X in the top right-hand corner to close the node builder.
  21. 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.

Previous Document Next Document