Creating a New Http Control

This topic describes how to create a new Http control.

Creating a New Http Control

You can create a new Http control and add it to your business process. To define a new Http control:

  1. Click Add on the Data Palette Controls tab to display a list of controls that represent the resources with which your business process can interact.
  2. Note: If the Controls tab is not visible in WebLogic Workshop, click View —> Windows —> Data Palette from the menu bar.

  3. Choose Integration Controls to display the list of controls used for integrating applications.
  4. Choose Http to display the Insert Control - Http dialog.
  5. In Step 1, in the Variable name for this control field, enter the name for your Http control.
  6. In Step 2, select the Create a new Http control to use radio button.
  7. In the New JCX name field, provide a name for the new file that you are about to create.
  8. Decide whether you want to make this a control factory and select or clear the Make this a control factory that can create multiple instances at runtime check box. For more information about control factories, see Control Factories: Managing Collections of Controls.
  9. In Step 3, specify the target URL for your Http control, for example, http://www.bea.com, https://www.verisign.com or http://localhost:7001/console.
  10. Select the HTTP mode that you want to use. You can select either the Get, or the Post mode.
  11. From the Sending Body Data Type drop-down list, select the data type. You can send your data as an XML object, String, or byte stream. This option is applicable only to the HTTP Post mode.
  12. From the Receiving Body Data Type drop-down list, select the data type in which you want to receive data. You can choose to receive data in a different format. For example, if you select the Byte data type for sending data and you want to receive the data as an XML object, you can do it.
  13. Click Create. Alternatively, you may create a Http control JCX file manually. For example, you may copy an existing Http control JCX file and modify the copy.

The JCX file for the Http Control

When you create a new Http control, you create a new JCX file in your project. The following is an example of a JCX file

package processes; 
import com.bea.control.*;
import com.bea.wli.control.httpResponse.ResponseDocument;
import com.bea.wli.control.httpParameter.ParametersDocument;
import com.bea.xml.XmlObject;
/*
     * A custom Http control.
     */ 
     /** 
     * @jc:httpsend-data url-name="http://localhost:7001/console"
     */ 
public interface GET extends HttpControl, com.bea.control.ControlExtension
     { 
     /*
* A version number for this JCX. This will be incremented in new versions of
this control to ensure that conversations for instances of earlier versions
were invalid.
     */ 
     static final long serialVersionUID = 1L;
ResponseDocument sendDataAsHttpGet(ParametersDocument parameters,String charset);
byte[] getResponseBodyData();  

The contents of the Http control's JCX file depend on the selections made in the Insert Http dialog. The given example was generated in response to selection of byte[] from the Body Type drop-down list.

Using the Http Control in a Business Process

The business process starts with a client request node, representing a point in the process at which a client sends a request to a process. In this case, the client invokes the setProperties method on the process to specify a dynamic property for your Http control.

Complete the following tasks to design your business process to send and receive data using your Http control, using a dynamic property setting that specifies the target URL to send and receive data.

To Design a Control Send Node in Your Business Process

  1. Expand the MyHttpControl control instance in the Data Palette. Then click the following method:
  2. setProperties(HttpControlPropertiesDocument propsDoc) 
    
  3. Drag the method from the Data Palette and drop it on your business process in the Design View, placing it immediately after the Client Request node.
  4. Double-click the SetProperties node. Its node builder opens on the General Settings tab.
  5. Confirm that MyHttpControl is displayed in the Control field and that the following method is selected in the Method field:
  6. setProperties(HttpControlPropertiesDocument propsDoc) 
    
  7. Click Send Data to open the second tab in the node builder. The Control Expects field is populated with the data type expected by the setProperties method: HttpControlPropertiesDocument.
  8. In the Select variables to assign field, choose Create new variable... using the name dynamicprop. Close the window.
  9. Double click on the client request node to open the node builder.
  10. Open the General Settings tab of the node builder and create a variable of type com.bea.wli.control.dynamicProperties.HttpControlPropertiesDocument.
  11. Open the Receive Data tab. The Client Sends field in this tab populated with the variables that have been created in the General Settings tab, in this case, HttpControlPropertiesDocument x0. In the Select variables to assign field, click the arrow to display the list of variables in your project and choose dynamicprop as the variable to assign.

This step completes the design of your Http control node.

At run time, the dynamic property that you defined will override the static property defined using the Property Editor.

Previous Document Next Document