GetURL method: IntBroker class

Syntax

GetURL(service_op_name, service_op_index, &doc_object, [secure_target], [encode_unsafe])

Description

Use this method to generate a fully qualified URL for any REST-based service operation resource.

Parameters

Parameter Description

service_op_name

Specifies the Integration Broker service operation as a string.

service_op_index

Specifies the index for the URI as an integer. This index corresponds to the row number in the URI grid of the REST Resource Definition section of the service operation definition.

&doc_object

Specifies the document template for the service operation as a Document object.

secure_target

Specifies whether the REST location is a secure target location. The default value is the non-secure target location.

encode_unsafe

Specifies whether to encode unsafe characters as a Boolean value. The default is False (no encoding).

Returns

A string populated with the fully qualified URL.

Example

HTML is generated within the OnRequest event of a REST-based provider service using links defined from other REST-based service operations. Note that the REST-based service operation resources on either the publishing node (the provider) or the subscribing node (the consumer) can be used to generate the fully qualified links.


import PS_PT:Integration:IRequestHandler;

class RESThandler implements PS_PT:Integration:IRequestHandler
   method OnRequest(&message As Message) Returns Message;
   method OnError(&request As Message) Returns string;
end-class;

method OnRequest
   /+ &message as Message +/
   /+ Returns Message +/
   /+ Extends/implements PS_PT:Integration:IRequestHandler.OnRequest +/
   Local Document &Doc_Tmpl, &DOC;
   Local Compound &COM_Tmpl, &COM;
   Local Message &response;
   Local string &STR, &STR1, &STR2, &STR3, &STR4, &strHTML;
   Local boolean &bRet;
   &response = CreateMessage(Operation.WEATHERSTATION_GET, %IntBroker_Response);
   /* read URI Document to get parms out from the request*/
   &Doc_Tmpl = &message.GetURIDocument();
   &COM_Tmpl = &Doc_Tmpl.DocumentElement;
   /* Instantiate a Document object based on the REST-based service operations ⇒
   document template that you want to create a link for */
   &DOC = CreateDocument("Weather", "WeatherTemplate", "v1");
   &COM = &DOC.DocumentElement;
   /* based off the data from the request populate the Document object */
   If &COM_Tmpl.GetPropertyByName("state").Value = "Washington" Then
   &COM.GetPropertyByName("state").Value = "Washington";
   /* call new method to create fully qualified URL(s) */
   &COM.GetPropertyByName("city").Value = "WhiteSalmon";
   &STR = %IntBroker.GetURL("WEATHERSTATION_GET", 2, &DOC, true, true);
   &COM.GetPropertyByName("city").Value = "Troutlake";
   &STR1 = %IntBroker.GetURL("WEATHERSTATION_GET", 2, &DOC);
   &COM.GetPropertyByName("city").Value = "Yakima";
   &STR2 = %IntBroker.GetURL("WEATHERSTATION_GET", 2, &DOC);
   &COM.GetPropertyByName("city").Value = "Lyle";
   &STR3 = %IntBroker.GetURL("WEATHERSTATION_GET", 2, &DOC);
   /* use these URLs as bind variables for the HTML definition */
   &strHTML = GetHTMLText(HTML.WEATHER_CITIES, &STR, &STR1, &STR2, &STR3);
   /* set the data in the response message */
   &bRet = &response.SetContentString(&strHTML);
   End-If;
   Return &response;
end-method;