Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Representational State Transfer (RESTful) has gained widespread acceptance across the Web as a simpler alternative to SOAP - and Web Services Description Language (WSDL) - based Web servicesServices. RESTful web service Web Service uses architectures architecture that use HTTP or similar protocols by restricting the interface to use standard operations like GET, POST, PUT, DELETE for HTTP. You can create Consumer/Provider activities with the RESTful Web Service Services using Adeptia SuitSuite.

...

Following are the major subsections:

This section explains the process of creating web service consumer activity for RESTful Web Service.
 

Steps to create Web Service Consumer activity for RESTful Web Service

...

On the create Web Service Consumer page, select the REST radio button (see Figure 355).

Image Removed

Figure 355: Create RESTful Web Service Consumer

...

In the URL textbox, enter the URL of the Web Service that you want to invoke.

Info

You need to pass the request in the URL.
You can also define the values of the parameters in the Parameter table.

To populate the Parameter table automatically from a URL, click the Extract Param from URL button. You can also populate the Parameter table along with their default values by giving the query parameters in the URL itself (see Figure 356).

Info

You can dynamically override a complete URL or any parameter of the URL with the value of any variable. To do this you need define the variable name in the URL field.
For Example, To override a complete URL you can define the URL as $$REST_URL_Var$$.

...

Select the style of the parameters from the Style drop-down list. It could be Query or Header.

Info

If you want to pass parameters as a part of HTTP request then, you need to select Header in the Style drop-down list.

...

  • Get
  • Put
  • Post
  • Delete

...

Select a security policy from the Security Policy drop-down list.

Info

...

When you use either Put or Post method, then following two additional options are displayed.

  • Post Query String
  • Enable Multipart 

...

Enable the Enable Multipart option.

  • In the Part Name field enter the name of the form-data field.
  • Enter the name of the file in the File Name field. This name will be used for the file, which will be posted to the Web Service. You have to pass the file, which you want to send through this consumer, as a source stream. You use file source activity to achieve it.
  • Modify the media type in the presentation table as explained below
  • Media type for Request should be multipart/form-data
  • Media type for Response varies for different web service. It can be application/json or application/xml.

...

Expand the Advanced Properties section to view the advance property of the RESTful web service consumer activity (see Figure 357).

Image Removed
Figure 357: Advanced Properties (RESTful Web Service Consumer Activity)

...

If you do not want your RESTful web service consumer activity to wait indefinitely for a response from a web service provider then, enter a timeout value in the Read Timeout (in seconds) text box. The default value is 0 which means your RESTful web service consumer activity will wait indefinitely for a response.

...

We can override the REST URL at run time by placing Put-Context-Var before Web Services REST Consumer Activity in the Process Flow.
 

Steps to override the REST URL:

...

Create a RESTful Consumer activity by using a dummy URL in the URL field (see Figure 358).

Info

To know how to create RESTful Consumer, please refer to the Creating Web Service Consumer Activity to Access RESTful Web Service section.

Image Removed
Figure 358: Create RESTful Web Service Consumer

...

Create a Target Activity.

Info

To know how to create a Target Activity, please refer to the Creating Target Activity section.

...

Create a process flow using the following activities in sequence (see Figure 359):

Server Entities

Description

Context Variable

Put-Context-Var

Consumer Activity

REST

Target Activity

Any

...

  1. Click hierarchy structure in the Repository View panel. Expand the Action list and select the put-context-var action to drag it to the Graph Canvas area before the REST Consumer Activity.
  2. Connect the put-context-var to the REST Consumer Activity.
  3. Right-click the put-context-var and select View Properties. Its properties are displayed in the Properties Panel in the Bottom Pane.
  4. Click the Edit button to edit the value of context variable. The Edit Context Variables dialog box is displayed (see Figure 360).

    Image Removed

    Figure 360: Edit Context Variables

  5. Click the Add Variable ( Image Removed ) to add new context variable. The Context Variable Information screen is displayed.
  6. Select the Rest Consumer activity (which is to be overridden) from the dropdown list Activity Name. All variables of this Rest Consumer activity are listed in the dropdown list Variable Name (seeFigure 361).

    Image Removed

    Figure 361: Context Variable Information

  7. Select restURL variable from the dropdown list Variable Name.
  8. Enter the Url that you want to override during the run time, in the textbox Variable Value.
  9. Click Done to close the Context Variable Information screen. This takes the control back to the screen Edit Context Variables. The newly created variable is added to the list of existing context variables.
  10. Click Done to close the Edit Context Variables screen and return to Process Designer.
  11. Select your Target activity.
  12. Save the process flow and exit from Process Designer.
  13. Execute the process flow, this overrides the dummy URL provided at the design time.
Info

There are two ways to override RESTful URL at the run time:

...

This section explains the process of creating web service provider activity for RESTful Web Service.
 

...

Step-by-step instructions to create Web Service Consumer activity for RESTful Web Service.

Overriding RESTful URL

Step-by-step instructions to override REST URL at runtime.

Creating Web Service Provider Activity to Publish RESTful Web Service

...

In Create Web Service Provider Screen, enter the name and description of the new Web Service Provider activity in the Name and Description textboxes respectively (see Figure 362).

In case the Web Services Provider activity contains characters which falls in character set encoding, other than the default character set encoding, then you can change this encoding in the Character Set Encoding textbox. By default, this textbox will display you the character set encoding that you have defined at the application level.

Image Removed

Figure 362: Create RESTful Web Service Provider

...

From the Process Flow Name drop-down list, select the process flow name that you want to trigger with this web service.

Info
  1. The process flow, which you select here, should have Context Source and Context Target activity.
  2. The parameterName attribute of the context source should be restRequest.
  3. The parameterName attribute of the context target should be restResponse.

...

Select the style of the parameter from the Style drop-down list.

Info

For the parameters that you want to pass as a part of HTTP header, select the Header option in the Style drop-down list.

...

To add methods to your activity, click on the Add Method button. This action will show you the Method Description screen (see Figure 363).

Image Removed

Figure 363: Define Method

...

Select the type of method from the Method Type drop-down list. The method type can be PUT, GET, POST, or DELETE. As per the type of method that you select, you will see a corresponding content in the Presentation Table (see Figure 364).

Image Removed

Figure 364: Add Method

...

Select the style of the parameter from the Style drop-down list.

Info

For the parameters that you want to pass as a part of HTTP header, select the Header option in the Style drop-down list.

...

Select the security policy from the Security Policy drop-down list.

Info

To know how to create Security policy, refer to the Creating Security Policy for Web Service section.
The RESTful Web Service Provider supports only basic authentication.

Click the Save button.

Info

A lot of WSDL files by default come with a dummy endpoint that do not point to the actual location of the service, but instead contains a dummy link, for example -http://example/servicename

This is because sometimes the WSDL file describes what the service looks like, but do not point where it is located. Therefore it should be possible to override the endpoint from within the Web Service Consumer configuration instead of having to do via the Process Designer.

...

Step-by-step instructions to create Web Service Provider activity for RESTful Web Service.