Creating a restRequest to use in a serviceRequest

To create a restRequest to use in a serviceRequest, follow these steps:

1. Start the Create New Web Service Request wizard, either:

Method

Description

  • Right click in UI file, or

  • Right click on Service Requests folder in Data view

  • From Tools menu

- Right click in the UI file and select Data > Create Service Request, or
right click on
Service Requests folder in Data view and select Create Service Request, or select Tools > Create Service Request.
The
Create serviceRequest dialog appears.

- Click New beside DataRequestID.
A dialog appears displaying a li
st of serviceRequest types.

- Select restRequest and click Next.

This launches the Create New Web Service Request wizard.

From nexaweb-
webservices file

-  In the Nexaweb perspective, double click on the nexaweb-webservices.xml file (in WebContent/WEB-INF/dataservice) in the Navigator view to open it.

- Select the Requests tab and click Add.
A
Configuration Element Selection dialog appears.

- Select restRequest and click Finish.

The Web Service Requests Configuration tab appears.

Note: The Web Service Requests Configuration tab contains the same fields as the New Web Service Request wizard.

 

2. Complete the Create New Web Service Request dialog as follows:
Note: If you started from the nexaweb-webservices.xml file, you see the Web Services Request Configuration tab.

image\img00620.gif

ID: Nexaweb Studio automatically assigns a restRequest ID as restRequest, with a suffix incremented by one for each additional request of this type created. (Except on The Web Services Request Configuration tab.) Keep the assigned ID or specify your own. Nexaweb Studio uses this ID to identify this restRequest in the nexaweb-webservices.xml file and to identify the dataRequestDefinition in the nexaweb-data.xml file that references this restRequest.

Method: Click the arrow in the Method selection box to select an HTTP method for this restRequest to execute, if any. If you do not specify a method, Nexaweb Studio uses the GET method by default.

 Click Next.
The
Create Sub Elements for Web Service Request dialog appears.

3. Complete the Create Sub Elements for Web Service Request dialog as follows.

image\img00621.gif

Url: Specifies the location of the REST resource.

Body: Specifies the content of the body portion of a PUT or POST request.

UrlParameters: Specifies all urlParameters, which specify, in name and value pair format, additional information to send to the REST resource. Click Add to specify a parameter name/value pair, Delete to remove one, or select one from the list and click Up/Down to change their order.

4. Click Finish.

 This creates a restRequest in the nexaweb-webservices.xml file and a dataRequestDefinition in the nexaweb-data.xml file that references this restRequest as a serviceResourceReference.

To get to the Create serviceRequest dialog:

- Right click in the UI file and select Data > Create Service Request. This launches the Create Service Request wizard.

5. Complete the Create serviceRequest dialog as follows:

image\img00622.gif

DataRequestID: Click the arrow to select the ID of an existing dataRequestDefinition or restRequest.

ID: Specifies an ID for this serviceRequest. Nexaweb Studio automatically creates an ID of serviceRequest with a suffix incremented by one for each additional serviceRequest that you create, or you can specify your own.

onFailure\onSuccess: Optionally, specify an MCO or Macro to run when the request fails or succeeds. Click Advanced to create one. For more information on creating an event, see Connecting Business Logic to the User Interface.

Target: Specify an existing document data source through which you can bind this data to the UI, or click New to create one. Nexaweb Studio copies the data from the data base to the document data source for use in the UI. For more information on creating a document data source ,see Creating a Data Source.

Optional Arguments: Click Add to specify a parameter for this serviceRequest. Specify the parameter name in the Name field and a value for this parameter in the Value field.

6. Click Finish.

 Nexaweb Studio adds the serviceRequest to the UI file and displays the name of this serviceRequest under the Service Requests folder in the Data view.