IBInfo Class Methods

In this section, we discuss the IBInfo class methods. The methods are discussed in alphabetical order.

All methods work with both asynchronous as well as synchronous messages unless specified

Syntax

AddAEAttribute(Name, value)

Description

Use this method to add an attribute as a name-value pair to the Message object to be passed back to the response application class defined on the Application Engine handler.

Parameters

Field or Control

Definition

Name

Specifies the attribute name as a string.

value

Specifies the attribute value as a string.

Returns

A Boolean value: True if the attribute was added successfully, False otherwise.

Example

/* Add the name value pair data you want to pass to the response app class */
/* in the AE program */

&b = &MSG.IBInfo.AddAEAttribute("sail name", "NorthWave");
If &b <> True Then
   MessageBox(0, "", 0, 0, "error adding ae attribute");
End-If;

&b = &MSG.IBInfo.AddAEAttribute("size", "4.2");
If &b <> True Then
   MessageBox(0, "", 0, 0, "error adding ae attribute");
End-If;

&b = &MSG.IBInfo.AddAEAttribute("type", "Surflite");
If &b <> True Then
   MessageBox(0, "", 0, 0, "error adding ae attribute");
End-If;

/* Need to call this method for the attributes to be saved and transferred */
/* correctly */
&b = &MSG.IBInfo.InsertAEResponseAttributes();
If &b <> True Then
   MessageBox(0, "", 0, 0, "error inserting AE response attributes");
End-If;

/* *********************************************************************** */
/* In the response application class to retrieve the name-value pairs      */

For &i = 1 To &MSG.IBInfo.GetNumberOfAEAttributes()
   
   &name = &MSG.IBInfo.GetAEAttributeName(&i);
   &value = &MSG.IBInfo.GetAEAttributeValue(&i);
   
End-For;

Syntax

AddAttachment(Path)

Description

Use the AddAttachment method to add an attachment to a message.

Parameters

Field or Control

Definition

Path

Specify an absolute path, including the file name and type, as a string, of the file you want to attach to the message.

Returns

A string containing a content ID, which can be used for accessing the attachment with other methods, such as DeleteAttachment or SetAttachmentProperty.

Example

The following example shows sending an attachment with an asynchronous message:

Local Message &MSG;
Local Rowset &FLIGHT_PROFILE;
Local String &Attachment_Id;
Local Boolean &Test;
Local IntBroker &IntBroker;

QE_FLIGHTDATA.QE_ACNUMBER.Value = QE_FLIGHTDATA.QE_ACNUMBER + 1;

&FLIGHT_PROFILE = GetLevel0();

&MSG = CreateMessage(Operation.ASYNC_RR);

&Attachment_Id = &MSG.IBInfo. AddAttachment("C:\\temp\\MyFile.txt");
&Test = &MSG.IBInfo.SetAttachmentProperty(&Attachment_Id, %Attachment_Encoding, "UTF-8");
&Test = &MSG.IBInfo.SetAttachmentProperty(&Attachment_Id, %Attachment_Base, "Standard");
&Test = &MSG.IBInfo.SetAttachmentProperty(&Attachment_Id, %Attachment_Disposition, "Pending");
&Test = &MSG.IBInfo.SetAttachmentProperty(&Attachment_Id, %Attachment_Language, "English");
&Test = &MSG.IBInfo.SetAttachmentProperty(&Attachment_Id, %Attachment_Description, "Parts data");

&MSG.CopyRowset(&FLIGHT_PROFILE);

&IntBroker = %IntBroker

&IntBroker.Publish(&MSG);

Syntax

AddAttribute(name, value)

Description

Use this method to add an attribute to an IBInfo object.

Note: This method can be used for content-based routing only, typically in your implementation of the IRouter.OnRouteSend or IRouter.OnRouteReceive methods.

The maximum length of the attribute name is 30 characters. The maximum length of the attribute value is 254 characters.

Parameters

Field or Control

Definition

name

Specifies the attribute name as a string.

value

Specifies the attribute value as a string.

Returns

A Boolean value: true if the addition of the attribute was successful, false otherwise.

Example

&bRet = &MSG.IBInfo.AddAttribute("employeeID", "123456");

Syntax

AddContainerAttribute(Name, Value)

Description

Use this method to add a container attribute by specifying an attribute name-value pair.

You can add attributes to container messages that contain rowset-based message parts to provide integration partners with data and information, without adding the information to the message definition.

Parameters

Field or Control

Definition

Name

Specifies the container attribute name as a string.

Value

Specifies the container attribute value as a string.

Returns

A Boolean value: True if the container attribute was added successfully, False otherwise..

Example

Local Message &MSG;
Local Rowset &RS;
Local boolean &Bo;

&RS = GetLevel0();
&MSG = CreateMessage(Operation.QE_CONT_ATTRB);

&Bo = &MSG.IBInfo.AddContainerAttribute("Test1", "1");
&Bo = &MSG.IBInfo.AddContainerAttribute("Test2", "10");
&Bo = &MSG.IBInfo.AddContainerAttribute("Test3", "100");

&MSG.CopyPartRowset(1, &RS);

%IntBroker.Publish(&MSG);

Syntax

ClearAEAttributes()

Description

Use this method to delete all Application Engine handler attributes from the Message object.

Parameters

None.

Returns

None.

Syntax

ClearAttachments()

Description

Use the ClearAttachments method to clear all attachments. If you want to delete a particular attachment, use DeleteAttachment instead.

Parameters

None.

Returns

None.

Syntax

ClearAttributes()

Description

Use this method to delete all attributes from an IBInfo object.

Note: This method can be used for content-based routing only, typically in your implementation of the IRouter.OnRouteSend or IRouter.OnRouteReceive methods.

Parameters

None.

Returns

None.

Example

&MSG.IBInfo.ClearAttributes();

Syntax

ClearContainerAttributes()

Description

Use this method to delete all container attributes in the IBInfo object.

Parameters

None

Returns

None

Example

&MSG.IBInfo.ClearContainerAttributes();

Syntax

DeleteAEAttribute(Name)

Description

Use this method to delete the Application Engine handler attribute specified by attribute name from the Message object.

Parameters

Field or Control

Definition

Name

Specifies the name of the attribute as a string.

Returns

A Boolean value: True if the deletion was successful, False otherwise.

Syntax

DeleteAttachment(Index | Content_ID)

Description

Use the DeleteAttachment method to remove the specified attachment from the message. You can either specify the number of the attachment, or the content ID associated with the attachment (generated when the attachment was added to the message with AddAttachment.)

If you want to clear all attachments, instead of a particular one, use the ClearAttachments methods instead.

Parameters

Field or Control

Definition

Index | Content_ID

Specify either the number of the attachment, or the content ID associated with the attachment, for the attachment you want to delete.

Returns

A Boolean value: true if the attachment was deleted successfully, false otherwise.

Syntax

DeleteAttribute(name)

Description

Use this method to delete an attribute from an IBInfo object by specifying the attribute’s name as a string.

Note: This method can be used for content-based routing only, typically in your implementation of the IRouter.OnRouteSend or IRouter.OnRouteReceive methods.

Parameters

Field or Control

Definition

name

Specifies the attribute by name as a string.

Returns

A Boolean value: true if the deletion of the attribute was successful, false otherwise.

Example

&bRet = &MSG.IBInfo.DeleteAttribute("employeeID");

Syntax

DeleteContainerAttribute(Name)

Description

Use this method to delete a container attribute based on the attribute name.

Parameters

Field or Control

Definition

Name

Specifies the container attribute name as a string.

Returns

A Boolean value: True if the deletion was successful, False otherwise.

Example

&Ret = &MSG.IBInfo.DeleteContainerAttribute("MyAttribute");

Syntax

GetAEAttributeName(nIndex)

Description

Use this method to return the name of the nth Application Engine handler attribute from the Message object. For example, the response application class can use this method to retrieve the attribute name.

Parameters

Field or Control

Definition

nIndex

An integer specifying which attribute in the Message object.

Returns

A string populated with the attribute name.

Syntax

GetAEAttributeValue(nIndex)

Description

Use this method to return the value of the nth Application Engine handler attribute from the Message object. For example, the response application class can use this method to retrieve the attribute value.

Parameters

Field or Control

Definition

nIndex

An integer specifying which attribute in the Message object.

Returns

A string populated with the attribute value.

Syntax

GetAttachmentContentID(Index)

Description

Use the GetAttachmentContentID to return the content ID for the specified attachment. The content ID is associated with an attachment when it is added to a message using AddAttachment.

You can use the content ID with other methods, such as AddAttachmentProperty and DeleteAttachment.

Parameters

Field or Control

Definition

Index

Specify the number of the attachment that you want to access the content ID for.

Returns

A string containing the content ID.

Syntax

GetAttachmentProperty(Content_ID, Property_Type)

Description

Use the GetAttachmentProperty method to return the value of an attachment property.

Parameters

Field or Control

Definition

Content_ID

Specify the content ID of the attachment that you want to access, as a string.

Property_Type

Specify the type of property that you want to access. Valid values are:

Constant Value

Description

%Attachment_Base

Specifies the base name of the attachment, that is, if the actual document name you want is different, such as if it is zipped or otherwise compressed as part of other documents.

%Attachment_Description

Specifies the description of the attachment.

%Attachment_Disposition

Specifies the disposition of the attachment, whether it's displayed inline or as an attachment.

%Attachment_Encoding

Specify the encoding of the attachment. For example, Content-type: text/plain or charset=Big5.

%Attachment_Language

Specify the language used in the attachment, as a string.

%Attachment_Location

Specify an additional location for the attachment.

%Attachment_Type

Specify the attachment type.

%Attachment_URL

Specifies the URL for the attachment. The URL must be an absolute URL.

Returns

A string containing the value of the specified property.

Example

The following example processes an attachment from a notification PeopleCode program:

Import PS_PT:Integration:INotificationHandler;

Class FLIGHTPROFILE implements PS_PT:Integration:INotificationHandler
   method FLIGHTPROFILE();
   method OnNotify(&MSG As Message);

end-class;

/* Constructor */
method FLIGHTPROFILE
   %Super = create PS_PT:Integration:INotificationHandler();
end-method;

method OnNotify
   /+ &MSG as Message +/
   /+ Extends/implements PS_PT:Integration:INotificationHandler.OnNotify +/

Local rowset &RS;
Local integer &Count;
Local string &Attachment_Id;
Local array of array of string &Result;

&RS = &MSG.GetRowset();

&Count = &MSG.IBInfo.NumberOfAttachments;
If &Count > 0 Then

   For &I = 1 to &Count
      &Attachment_ID = &MSG.IBInfo.GetAttachmentContentID(&I);
      &Result[&I][1] = &MSG.IBInfo.GetAttachmentProperty(&Attachment_Id, %Attachment_Encoding);
      &Result[&I][2] = &MSG.IBInfo.GetAttachmentProperty(&Attachment_Id, %Attachment_Type);
      &Result[&I][3] = &MSG.IBInfo.GetAttachmentProperty(&Attachment_Id, %Attachment_URL);
      &Result[&I][4] = &MSG.IBInfo.GetAttachmentProperty(&Attachment_Id, %Attachment_Base);
      &Result[&I][5] = &MSG.IBInfo.GetAttachmentProperty(&Attachment_Id, %Attachment_Location);
      &Result[&I][6] = &MSG.IBInfo.GetAttachmentProperty(&Attachment_Id, %Attachment_Disposition);
      &Result[&I][7] = &MSG.IBInfo.GetAttachmentProperty(&Attachment_Id, %Attachment_Description);

   End-For;

End-if;

/* process data from message */

end-method;

Syntax

GetAttributeName(nIndex)

Description

Use this method to return the attribute name for the nth attribute of the IBInfo object as a string.

Note: This method can be used for content-based routing only, typically in your implementation of the IRouter.OnRouteSend or IRouter.OnRouteReceive methods.

Parameters

Field or Control

Definition

nIndex

An integer specifying which attribute in the IBInfo object.

Returns

A string populated with the attribute name.

Example

&AttrName = &MSG.IBInfo.GetAttributeName(&i);

Syntax

GetAttributeValue(nIndex)

Description

Use this method to return the attribute value for the nth attribute of the IBInfo object as a string.

Note: This method can be used for content-based routing only, typically in your implementation of the IRouter.OnRouteSend or IRouter.OnRouteReceive methods.

Parameters

Field or Control

Definition

nIndex

An integer specifying which attribute in the IBInfo object.

Returns

A string populated with the attribute value.

Example

&AttrValue = &MSG.IBInfo.GetAttributeValue(&i);

Syntax

GetContainerAttributeName(nIndex)

Description

Use this method to return the attribute name for the nth container attribute of the IBInfo object as a string.

Parameters

Field or Control

Definition

nIndex

An integer specifying which container attribute in the IBInfo object.

Returns

A string populated with the container attribute name.

Syntax

GetContainerAttributeValue(nIndex)

Description

Use this method to return the attribute value for the nth container attribute of the IBInfo object as a string.

Parameters

Field or Control

Definition

nIndex

An integer specifying which container attribute in the IBInfo object.

Returns

A string populated with the container attribute value.

Syntax

GetNumberofAEAttributes()

Description

Use this method to return the number of Application Engine handler attributes in the Message object. For example, the response application class can use this method to retrieve the number of attributes before retrieving the attribute name-value pairs.

Parameters

None.

Returns

An integer representing the number of Application Engine handler attributes.

Syntax

GetNumberOfAttributes()

Description

Use this method to get the number of attributes for the IBInfo object as an integer.

Note: This method can be used for content-based routing only, typically in your implementation of the IRouter.OnRouteSend or IRouter.OnRouteReceive methods.

Parameters

None.

Returns

An integer representing the number of attributes for the IBInfo object.

Example

For &i = 1 To &MSG.IBInfo.GetNumberOfAttributes()
   &AttrName = &MSG.IBInfo.GetAttributeName(&i);
   &AttrValue = &MSG.IBInfo.GetAttributeValue(&i);
End-For;

Syntax

GetNumberOfContainerAttributes()

Description

Use this method to return the number of container attributes in the IBInfo object.

Parameters

None

Returns

An integer representing the number of container attributes.

Example

&MSG = CreateMessage(Operation.FLIGHTPLAN);

&ret = &MSG.IBInfo.AddContainerAttribute("MESSAGE_STATUS", "good");
&ret = &MSG.IBInfo.AddContainerAttribute("MyAttribute", "abcd");

/* When attempting to read these attributes within an IB event (OnNotify,  */
/* OnRequest etc.) one must first get a part rowset, this will load up the */
/* attributes into the message object from the xml. Here is an example of  */
/* how to read the attributes from a message.                              */

&RS = &MSG.GetPartRowset(1);
&index = &MSG.Ibinfo.GetNumberOfContainerAttributes();

For &i = 1 To &index
   
   &attrName = &MSG.Ibinfo.GetContainerAttributeName(&i);
   &attrValue = &MSG.Ibinfo.GetContainerAttributeValue(&i);
   
End-For;

Syntax

GetTransactionIDforAE()

Description

Use this method to get the transaction ID from within Application Engine program.

Parameters

None.

Returns

A number representing the transaction ID from within Application Engine program.

Syntax

InsertAEResponseAttributes()

Description

Use this method to save and transfer the Application Engine handler attributes to be read by the response application class.

Parameters

None.

Returns

A Boolean value: True if the save and insertion were successful, False otherwise.

Syntax

LoadConnectorProp(ConnectorName)

Description

Use the LoadConnectorProp method to load connector properties to the specified connector. The properties are contained in the message executing the method.

Note: Use this method in the message OnSend event.

Parameters

Field or Control

Definition

ConnectorName

Specify the name of the connector that you want to load properties for from the message.

Returns

A Boolean value: true if properties are loaded successfully, false otherwise.

Example

LOCAL MESSAGE &MSG; 
&MSG = %IntBroker.GetMessage(); 
&Rowset = &MSG.GetRowset();
&MSG.IBInfo.LoadConnectorProp("HTTP TargetConnector"); 
/* add connector properties */
&MSG.IBInfo.ConnectorOverride= true; 
ReturnToServer(&MSG);

Syntax

LoadConnectorPropFromNode(NodeName)

Description

Use the LoadConnectorPropFromNode method to load connector properties into the message executing the method. Then you can use the LoadConnectorProp method to load the specified connector with the properties.

Note: Use this method in the message OnSend event.

Parameters

Field or Control

Definition

NodeName

Specify the node that contains the connector properties you want to use. You can either specify the node name as a string, or prefix the node name with the reserved word Node.

Returns

A Boolean value: true if the properties are loaded successfully, false otherwise.

Syntax

LoadConnectorPropFromRouting(RoutingDefnName)

Description

Use the LoadConnectorPropFromRouting method to load connector properties into the message executing the method. Then you can use the LoadConnectorProp method to load the specified connector with the properties.

Parameters

Field or Control

Definition

RoutingDefnName

Specify the routing definition name that contains the connector properties you want to use, as a string.

Returns

A Boolean value: true if the method completes successfully, false otherwise.

Syntax

LoadConnectorPropFromTrx(NodeName, TransactionType, MsgName, MsgVersion)

Description

Note: This method is no longer supported.

Syntax

LoadRESTHeaders()

Description

Use this method to load the headers defined on the appropriate routing for a REST-based service operation. Once loaded, the headers can be modified without specifying the connector override property.

Parameters

None.

Returns

A Boolean value: True if the method executed successfully, False otherwise.

Note: The connector override property does not need to be set when using LoadRESTHeaders.

Example

The following example demonstrates how you can modify HTTP headers through PeopleCode. In this example, the request on the subscribing node (the consumer) is modified.

Note: No HTTP properties are currently applicable for REST and will be removed by Integration Broker.

&request = CreateMessage(Operation.MAPS_GET);

&bRet = &request.IBInfo.LoadRESTHeaders();

/* Add any additional headers not defined on the routing */
&bRet = &request.IBInfo.IBConnectorInfo.AddConnectorProperties("Content-Language", "eng", %HttpHeader);

The following example demonstrates how you can add HTTP headers to a REST-based service operation response within an OnRequest event:

&response = CreateMessage(Operation.WEATHERSTATION_GET, %IntBroker_Response);

&bRet = &response.IBInfo.LoadRESTHeaders();

/* Add or modify additional headers not defined on the routing */
&bRet = &response.IBInfo.IBConnectorInfo.AddConnectorProperties("Content-Language", "eng", %HttpHeader);

Return &response;

Syntax

SetAttachmentProperty(Content_ID, Property_Type, Value)

Description

Use the SetAttachmentProperty to specify the value and type of a property associated with an attachment.

Parameters

Field or Control

Definition

Content_ID

Specify the content ID associated with the attachment.

Property_Type

Specify the type of property. See below for the valid values.

Value

Specify the value associated with this property.

For the Property_Type parameter, the valid values are:

Constant Value

Description

%Attachment_Encoding

Specify the encoding type.

%Attachment_Type

Specify the attachment type.

%Attachment_URL

Specifies the URL for the attachment. The URL must be an absolute URL.

%Attachment_Base

Specify the attachment base.

%Attachment_Location

Specify an additional location for the attachment.

%Attachment_Disposition

Specifies the disposition of the attachment, whether it's displayed inline or as an attachment.

%Attachment_Description

Specifies the description of the attachment.

Returns

A Boolean value: true if the property is set successfully, false otherwise.

Example

The following example shows sending an attachment with an asynchronous message:

Local Message &MSG;
Local Rowset &FLIGHT_PROFILE;
Local String &Attachment_Id;
Local Boolean &Test;
Local IntBroker &IntBroker;

QE_FLIGHTDATA.QE_ACNUMBER.Value = QE_FLIGHTDATA.QE_ACNUMBER + 1;

&FLIGHT_PROFILE = GetLevel0();

&MSG = CreateMessage(Operation.ASYNC_RR);

&Attachment_Id = &MSG.IBInfo. AddAttachment("C:\\temp\\MyFile.txt");
&Test = &MSG.IBInfo.SetAttachmentProperty(&Attachment_Id, %Attachment_Encoding, "UTF-8");
&Test = &MSG.IBInfo.SetAttachmentProperty(&Attachment_Id, %Attachment_Base, "Standard");
&Test = &MSG.IBInfo.SetAttachmentProperty(&Attachment_Id, %Attachment_Disposition, "Pending");
&Test = &MSG.IBInfo.SetAttachmentProperty(&Attachment_Id, %Attachment_Language, "English");
&Test = &MSG.IBInfo.SetAttachmentProperty(&Attachment_Id, %Attachment_Description, "Parts data");

&MSG.CopyRowset(&FLIGHT_PROFILE);

&IntBroker = %IntBroker

&IntBroker.Publish(&MSG);