Creating a New Consumer Application Service

Starting with PeopleTools 8.60 the Application Service Framework supports generating Consumer Application Services to call 3rd party provider integrations.

To create a new Consumer Application Service:

  1. Select PeopleTools > Integration Broker > Application Services > Manage Application Services.

  2. Select Create Application Service.

This example illustrates the fields and controls on the Application Services – General Information page to create a new Consumer Application Service. You can find definitions for the fields and controls later on this page.

Create New Consumer Application Service

Field or Control

Description

App Service ID

Service ID for the Application Service.

Service Type

When you create a new Consume Application Service, the Service Type is Primary only.

Service URL ID

Service URL ID forms a part of the endpoint URL. It identifies the service to be executed.

Status

Status for the Application Service. When you create a new Application Service, the default Status is Active.

Enable SSL

Requires SSL for the Service to be invoked.

Service Category

Select Consumer.

Service Group

Used to group services together for search.

Owner ID

Owner of the Application Service.

Description

A description for the Application Service.

The Save action will perform the following:

  • Verify that the Service URL ID value meets the Oracle standard for an URL value. If valid, the value will then be checked against Integration Broker Service Alias's to insure it is unique. If the value does not meet this criteria, a pop up message will be displayed.

    This example illustrates the Service URL ID validation message.

    Service URL ID validation message

    Correct the Service URL ID and save the application service.

  • When the Service URL ID is valid, save processing will generate the necessary IB metadata, update the Service Name and enable the Create Root Resource button.

This example illustrates the fields and controls on the Application Service page for Consumer Application Service after Save. You can find definitions for the fields and controls later on this page.

Application Service page for Consumer Application Service after Save

Field or Control

Description

Security

Select this link to set the Security details.

Create Root Resource

Select this button to create a new root resource.

The Security link at the Service level can be used to update the security for all defined methods of the Service.

The provider of the integration will define what security will be required to invoke their integration(s). This can be Basic Authentication, oAuth2 or no security at all. For each method (integration) the appropriate security can be set by selecting the Security link. The developer can then select the Authentication Option.

This example illustrates the fields and controls on the Security Details page. You can find definitions for the fields and controls later on this page.

Security Details page

Field or Control

Description

Authentication Option

Authentication Option are Basic Auth or oAuth2

Update all current methods

Select this check box to propagate the security information to all the methods.

Basic Authentication

This example illustrates the fields and controls on the Security Details page when Basic Auth is selected. You can find definitions for the fields and controls later on this page

Basic Auth

Field or Control

Description

Authentication Option

Basic Authentication

External User ID

User ID

External Password

User ID password

oAuth2

3rd party Authorization Service information should first be registered on the oAuth2 security pages see Creating a Service Application.

This example illustrates the fields and controls on the Security Details page when oAuth2 is selected. You can find definitions for the fields and controls later on this page.

oAuth2

Field or Control

Description

Authorization Option

oAuth2

OAuth Name

Select the OAuth name from the drop down list. All registered Service Applications are available from the drop down list.

Update all current methods

Select this check box to propagate the security information to all the methods.

Use the Create Root Resource page to create a new root resource.

Select the Create Root Resource button from the Application Service page.

This example illustrates the fields and controls on the Create Root Resource page for a Consumer Application Service. You can find definitions for the fields and controls later on this page.

Create Root Resource page

Field or Control

Description

Root Resource

The name of the Root Resource defined by the Provider.

Description

A description of the root resource.

Status

Status for the root resource. When a root resource is created, the default status is Active.

REST Base URL

The base URL as defined by the Provider Integration to be called.

Note: For the cases where a root resource cannot be established then any root resource name will do as long as it complies with the Oracle naming standards.

Once the root resource is created for the Application Service it is displayed on the page.

This example illustrates the fields and controls on the Application Service page after root resource is created.

Consumer Application Service

Select the Root Resource name to open the Root Resource page.

This example illustrates the fields and controls on the Consumer Root Resource page.

Consumer Root Resource

Select the Add URI Template button to define the URI templates for this resource. See Adding URI Templates.

The following example demonstrates how the consumer application service with IB Service Name CONSUME_EXAMPLE is invoked:

import PTCBAPPLSVCDEFN:ApplicationServiceBase; /* Import the Application Service Base class */
import PTCBAPPLSVCDEFN:MessageAPI; /* used to get the ServiceAPI object */

Local PTCBAPPLSVCDEFN:ApplicationServiceBase &base;
Local PTCBAPPLSVCDEFN:MessageAPI &ServiceAPI;

&base = create PTCBAPPLSVCDEFN:ApplicationServiceBase(); /* instantiate and return the base object */
/* Returns the ServiceAPI based on the Application Service keys (Application Service name, 
Root Resource, URI Index, and REST Method) */
&ServiceAPI = &base.createService("CONSUME_EXAMPLE", "conroot", 1, %AppService_HTTP_GET);
/* Populate any Template Parameters based on the URI Index */
&ServiceAPI.setTemplateParameter("flightNumber", "12X20", False);
&ServiceAPI.setTemplateParameter("pilots", "DogDish", True);
&ServiceAPI.setTemplateParameter("pilots", "Hammer", True);
/* use the &ServiceAPI to populate any Input Parameters */
/* User Exception Option which when set if an error occurred will not terminate
the actual Synchronous Transaction but will allow the developer to read the error and continue processing. */
&ServiceAPI.UserException = True;
/* allows the developer to override the entire URL used to invoke the Application Service */
rem &ServiceAPI.SetOverrideURL(http://xxxxxxx:5000/PSIGW/RESTListeningConnector/T60KAC11/flightdata.v1/flight);
/* Invokes the Application Service via an Integration Broker SyncRequest */
&base.invokeService();
Local integer &RespCode;
Local string &RawData;
/* check for exception if User Exception set */
If &ServiceAPI.ResponseFailed Then
   &RespCode = &ServiceAPI.HttpResponseCode; /* read the HTTP Response Code returned by the Provider */
   Local string &RespException = &ServiceAPI.ResponseException; /* Read the Response Exception returned as a result of the invocation */
   &RawData = &ServiceAPI.getOutputContentData(); /* read any actual data returned by the Provider */
   
Else
   /* use the &ServiceAPI to read the data returned by the Provider (Output Parameters) */
   Local string &Program = &ServiceAPI.getOutputParameter("flightProgram");
   Local string &ACType = &ServiceAPI.getOutputParameter("aircraftType");
   &RespCode = &ServiceAPI.HttpResponseCode; /* read the HTTP Response Code returned by the Provider */
   &RawData = &ServiceAPI.getOutputContentData(); /* optionally read actual raw data returned by the Provider */
   
End-If;

REST consumer transactions are sent uncompressed by default. In order to send data compressed, the developer should set the following on the HTTP Header Page of the Application Service:

Header Type: Request

Property Name: sendCompressed

Value: Y

Alternatively, the developer can set this option via PeopleCode:

&ServiceAPI.setRequestHeader("sendUncompressed", N");