# Creating a New Service Broker Control

This topic describes how to create a new Service Broker control. To learn about Service Broker controls, see Overview: Service Broker Control.

You can create a Service Broker control in two different ways, which are described in the following sections:

- Creating a New Service Broker Control Using the Control Wizard
- Creating a Service Broker Control from a Business Process

### Creating a New Service Broker Control Using the Control Wizard

You can create a new Service Broker control and add it to your Web service or business process by using the Insert Control - Service Broker dialog.

Notes: When creating a Service Broker control that references a business process (JPD), the business process must be in the current WebLogic Workshop application.

If you are not in Design View, click the Design View tab.

To create a new Service Broker control:

1. Click Add on the Data Palette Controls tab to display a drop-down list of controls that represent the resources with which your business process can interact.

Note: If the Controls tab is not visible in WebLogic Workshop, click View —> Windows —> Data Palette from the menu bar.

2. Highlight Integration Controls to display the list of controls used for integrating applications.
3. Select ServiceBroker.

The Insert Control - ServiceBroker dialog appears.

4. In Step 1, in the Variable name for this control field, type the name for your Service Broker control.
5. In Step 2, select the Create a new Service Broker control to use radio button.
6. In the New JCX name field, type the name of the new file.
7. In Step 3a, browse for the file (.jpd, .jws, or .wsdl) representing the specific service you want to access.
8. In Step 3b, select a start method from the Start Method menu. Only those start methods contained in the specified service are displayed.
9. In Step 3c, enter a query in the Query field or click the Query Builder button to display the Dynamic Selector query builder. This step is optional. If you only plan to use the setProperties() method to define properties, you do not need to define a dynamic selector.

If you invoked the Dynamic Selector query builder, perform the following steps to build and test a query:

1. Select the type of lookup function for the query by choosing the LookupControl or TPM radio button. Choose TPM to bind lookup values to properties in the TPM repository. Choose LookupControl to bind lookup values to dynamic properties specified in a domain-wide DynamicProperties.xml file. You should only edit the DynamicProperties.xml file to bind lookup values to dynamic properties if the domain is inactive. If the domain is active, it is recommended that you use the WebLogic Integration Administration Console to bind lookup values.

For more information on binding lookup values to dynamic properties using the WebLogic Integration Administration Console, see "Adding or Changing Dynamic Control Selectors" in Process Configuration in Managing WebLogic Integration Solutions, which is available at the following URL:

http://e-docs.bea.com/wli/docs81/manage/processconfig.html#1039959

2. In the Start Method Schema area, select an element from the schema to associate it with the start method of the control. Only XML elements are displayed; non-XML elements are not supported. The resulting query appears in the XQuery area.
3. Click OK. The Insert Service Broker dialog is displayed with the query shown in the Query field.

10. Click Create.

The Service Broker control is created and displayed in the Applications tab. An instance of the control is also created and is added to the Data Palette.

### Creating a Service Broker Control from a Business Process

You can create a Service Broker control from an existing business process.

1. Right-click a JPD filename in the Application Pane and choose Generate Service Broker Control.

The Dynamic Selector Generation dialog is displayed.

2. Select a start method from the Start Method menu. Only those start methods contained in the specified business process are displayed.
3. To specify a dynamic selector, enter a query in the Query field or click the Query Builder button to display the Dynamic Selector query builder.

If you invoked the Dynamic Selector query builder, perform the following steps to build and test a query:

1. Select the type of lookup function for the query by choosing the LookupControl or TPM radio button. Choose TPM to bind lookup values to properties in the TPM repository. Choose LookupControl to bind lookup values to dynamic properties specified in a domain-wide DynamicProperties.xml file. You should only use LookupControl to bind lookup values to dynamic properties if the domain is inactive. If the domain is active, it is recommended that you use the WebLogic Integration Administration Console to bind lookup values.

For more information on binding lookup values to dynamic properties using the WebLogic Integration Administration Console, see "Adding or Changing Dynamic Control Selectors" in Process Configuration in Managing WebLogic Integration Solutions, which is available at the following URL:

http://e-docs.bea.com/wli/docs81/manage/processconfig.html#1039959

2. In the Start Method Schema area, select an element from the schema to associate it with the start method of the control. The resulting query appears in the XQuery area.
3. Click OK.

4. A new JCX file is displayed, indented beneath the selected JPD file. The Service Broker control JCX file is named using a prefix of SBControl to help distinguish it from Service controls. For example, if the associated JPD file is MyProcess.jpd, the generated Service Broker control JCX file is named MyProcessSBControl.jcx.

Note: Alternatively, you may create a Service Broker control JCX file manually. For example, you may copy an existing Service Broker control JCX file and modify the copy.

#### Notes on XQueries

When you are using XQuery expression and the XQuery Builder, it is important to remember:

- If you create a new Process control and want to use the XQuery Builder to associate an element in the schema with the start method for the new control, remember that XQuery Builder will only declare namespaces for schemas used in argument 2. So, if argument 1 uses "schema1", but argument 2 does not use "schema1", it will not declare namespace "schema1".
- If you use the XQuery Builder to generate XQuery expressions that involve an optional element, it is possible that you will have to manually edit the expression to generate a correct XPath location.
- Some XQuery expressions are not supported when using complex Predicates.