Message Class Methods
In this section, we discuss the Message class methods. The methods are discussed in alphabetical order.
Syntax
Clone()
Description
The Clone method creates an identical copy of the message, copying the data tree of the message executing the method. The Clone function sets the following properties for the resulting message object, based on the values set for the message definition created in Pure PeopleSoft Internet Architecture:
Name
QueueName
IsOperationActive
Other properties are set when the message is published or subscribed to (TransactionID, PubNodeName, and so on), or are dynamically generated at other times (Size, IsEditError, and so on.)
Clone creates a unique version of the message. If the original message changes, it is not reflected in the cloned object.
Parameters
None.
Returns
A message object.
Example
Clone could be used in a Hub and Spoke messaging environment. The Hub node uses this method during notification processing to publish a copy of the messages it receives from the Spokes.
&Msg = %IntBroker.GetMessage();
&Rowset = &Msg.GetRowset();
&Clone = &Msg.Clone();
%IntBroker.Publish(&Clone);
The hub's publication routing rules are then used to determine which spokes receive the message.
Syntax
CopyPartRowset(PartIndex, &Rowset)
Description
Use the CopyPartRowset to copy the rowset specified by &Rowset to the part of the message specified by PartIndex.
Note: This method only works with rowset-based container messages.
The primary record of the level zero rowset for both the specified message part and the specified rowset must be the same.
Parameters
Parameter |
Description |
---|---|
PartIndex |
Specify the number of the part you want to copy the rowset data to. |
&Rowset |
Specify an already instantiated rowset object that contains the data that you want to copy to the message part. |
Returns
None.
Syntax
CopyRowset(source_rowset [, record_list]);
Where record_list is a list of record names in the form:
RECORD.source_recname1, RECORD.target_recname1
[, RECORD.source_recname2, RECORD.target_recname2]. . .
Description
The CopyRowset method copies data from the source rowset to the like-named fields in the message object executing the method. This is an easy way to populate a message with data from a component.
Note: If a Related Language record is defined on a record that is effective dated, then the result of the CopyRowset method will not populate the Effective Date or Effective Sequence fields due to possible ambiguity when processed on the receiving system. If these fields are desired to include this information, then the Message Rowset can be updated accordingly after the CopyRowset call is invoked.
Note: CopyRowset copies the data, including rows that haven’t been modified. If you want to copy only data that has changed in some way, use the CopyRowsetDelta method.
See CopyRowsetDelta.
When the record names in the message and component do not match exactly, use the optional record_list to specify the records to be copied from the component into the message.
When you use the CopyRowset method to copy the contents from the source rowset to the message object, you are creating a unique copy of the object. If you change the original rowset, the message object is not changed.
Note: You can execute CopyRowset against a message only once. After a message is populated, any other CopyRowsets are ignored. If you have to populate different levels of a message rowset separately, you can use the CreateRowset method to create a rowset that has the same structure as your message, populate the created rowset, then use CopyRowset to populate your message. You can also use the Rowset CopyTo method to populate a message rowset, then populate the PSCAMA record by hand.
Parameters
Parameter |
Description |
---|---|
source_rowset |
Specifies the name of the rowset to be copied into the message object. |
record_list |
Specifies specific source and target records to be copied into the message object. |
Returns
None.
Example
The following example copies an entire component into a message object.
&Msg = %IntBroker.GetMessage();
&Rowset = &Msg.GetRowset()
&Component_Rowset = GetLevel0();
&Msg.CopyRowset(&Component_Rowset);
The following example copies a header/line page rowset into a header/line message object, using the record_list because the record names don't match:
&Msg = %IntBroker.GetMessage();
&Rowset= &Msg.GetRowset();
&Component_Rowset = GetLevel0();
&Msg.CopyRowset(&Component_Rowset, RECORD.PO_HDR_VW, RECORD.PO_HDR, RECORD.PO_LINE_VW, RECORD.PO_LINE);
Syntax
CopyRowsetDelta(source_rowset [, record_list]);
Where record_list is a list of record names in the form:
[RECORD.source_recname1, RECORD.target_recname1
[, RECORD.source_recname2, RECORD.target_recname2]]. . .
Description
The CopyRowsetDelta method copies rows of data that have changed from the source rowset to the like-named records and like-named fields in the message object executing the method.
Note: CopyRowsetDelta copies all the like-named fields from the changed row into the message. It is not copying just the changed like-named fields.
When the record names in the message and component do not match exactly, use the optional record_list to specify the records to be copied from the component into the message. The specified target records must be records in your message, while the specified source records must be records in a rowset that exists in the data buffer and is populated.
This is an easy way to populate a message when the records in the message match the records in the component that the message is published from.
In addition, the CopyRowsetDelta method sets the AUDIT_ACTN field in the PSCAMA table for every row in the message. The notification process can then use PSCAMA.AUDIT_ACTN to determine how to process every row that was published.
The set values match those used in audit trail processing, that is:
A - Row inserted.
D - Row deleted.
C - Row changed (updated), but no key fields changed. The system copies the new value to the Message rowset.
K - Row changed (updated), and at least one key field changed. The system copies the old value to the Message rowset and the new value (see "N").
N - Row changed (updated), and at least one key field changed. The system copies the old value to the Message rowset and the new value (see "K").
"" − blank value means that nothing on that row has changed. This is the default value, and is the value used to tag the parent rows of children that have changed.
Note: If a child row is inserted (or changed or deleted) CopyRowsetDelta also copies the parent row (and the parent row of that row, and so on, up to the top row) so the subscriber has a full picture of the transaction. A blank value is set in the AUDIT_ACTN field for these rows to let the subscriber know they don’t have to take action; the parent rows are there for reference only.
The Audit_Action values "A", "C", "D" are set when a record is added, changed, or deleted, respectively. In some cases such as effective-dated records, the user may change a key field value, such as Effective Date. In response to such an user action, two records are created, one with an Audit_Action value of "N", and the other with Audit_Action value "K". The "N" record has all the new values, while the "K" record retains the old values.
When you use the CopyRowsetDelta method to copy the contents from the source rowset to the message object, you are creating a unique copy of the object. If you change the original rowset, the message object is not be changed.
Note: You can execute CopyRowsetDelta against a message only once. After a message is populated, any other CopyRowsetDeltas are ignored. If you have to populate different levels of a message rowset separately, you can use the CreateRowset method to create a rowset that has the same structure as your message, populate the created rowset, then use CopyRowsetDelta to populate your message. You can also use the Rowset CopyTo method to populate a message rowset, then populate the PSCAMA record by hand.
Parameters
Parameter |
Description |
---|---|
source_rowset |
Specifies the name of the rowset to be copied into the message object. |
record_list |
Specifies source and target records to be copied into the message object. The target records must be records in your message, while the source records must be records in a rowset that exists in the data buffer and is populated. |
Returns
None.
Example
The following example copies all the changed rows of data from a component into a message object.
&Component_Rowset = GetLevel0();
&Msg.CopyRowsetDelta(&Component_Rowset);
Syntax
CopyRowsetDeltaOriginal(source_rowset [, record_list]);
Where record_list is a list of record names in the form:
[RECORD.source_recname1, RECORD.target_recname1
[, RECORD.source_recname2, RECORD.target_recname2]].
. .
Description
The CopyRowsetDeltaOriginal method copies rows of data that have changed from the source rowset to the like-named records and like-named fields in the message. It also copies the original value of the changed rows.
Note: CopyRowsetDeltaOriginal copies all the like-named fields from the changed and original rows into the message. It is not copying just the changed like-named fields.
When the record names in the message and component do not match exactly, use the optional record_list to specify the records to be copied from the component into the message. The specified target records must be records in your message, while the specified source records must be records in a rowset that exists in the data buffer and is populated.
The CopyRowsetDeltaOriginal method sets the AUDIT_ACTN field in the PSCAMA table for every row in the message. The notification process can then use PSCAMA.AUDIT_ACTN to determine how to process every row that was published.
The set values match those used in audit trail processing, that is:
A - Row inserted.
D - Row deleted.
C - Row changed (updated), but no key fields changed. The system copies the new value to the Message rowset and the original value (see "O" below).
O - Prior value of changed row. The system copies the new value to the Message rowset and the original value (see "C").
K - Row changed (updated), and at least one key field changed. The system copies the original value to the Message rowset and the new value (see "N").
N - Row changed (updated), and at least one key field changed. The system copies the original value to the Message rowset and the new value (see "K").
"" − blank value means that nothing on that row has changed. This is the default value, and is the value used to tag the parent rows of children that have changed.
Note: If a child row is inserted (or changed or deleted) CopyRowsetDeltaOriginal also copies the parent row (and the parent row of that row, and so on, up to the top row) so the subscriber has a full picture of the transaction. A blank value is set in the AUDIT_ACTN field for these rows to let the subscriber know they don’t have to take action; the parent rows are there for reference only.
The Audit_Action values "A", "C", "D" are set when a record is added, changed or deleted, respectively. When a row is changed, two records are created, one with an Audit_Action of "C", the other with Audit_Action value of "O". The "C" record has all the new values, while the "O" record retains the original values. In some cases such as effective-dated records, a user may change a key field value, such as Effective Date. In response to such an user action, two records are created, one with an Audit_Action value of "N", and the other with Audit_Action value "K". The "N" record has all the new values, while the "K" record retains the original values. The "N"/"K" combination is also created if both a key change and a non-key change is made on the same row of data.
The following table details the output from CopyRowsetDeltaOriginal:
User Action |
CopyRowsetDeltaOriginal Output |
Comments |
---|---|---|
Change a key. |
"N" and "K" rows created. |
The "K" row contains the original Key value, the "N" row, the new. |
Change a Key + change a Non-Key. |
"N" and "K" rows created only (that is: no "C"/"O" rows in that case). |
The Key and Non-Key Original Values are both contained in the "K" row. |
Change a Non-Key. |
"C" and "O" rows created. |
Original Value stored in "O" row. |
Add non-effective dated row. |
"A" row created. |
No additional rows created. |
Add effective-dated row and only 1 original effective-dated row exists. |
"A" and "O" rows created. |
"O" row contains the original effective dated row. |
Add effective-dated row and more than 1 original effected dated rows exist. |
"A" and "O" rows created. |
"O" row contains data from row that cursor was on when the new row was added. For example: If a rowset contains two rows (01/01/1980 and 02/02/2000), the current row is the 01/01/1980 row and the user adds a new row with today's date. The original values contain the data from the 01/01/1980. Likewise, if a rowset contains two rows (01/01/1980 and 02/02/2000), the current row is the 02/02/2000 row and the user adds a new row with today's date. Then the original values contain the data from the 02/02/2000. |
Delete a row |
"D" row created. |
No additional rows created. |
When you use the CopyRowsetDeltaOriginal method to copy the contents from the source rowset to the message object, you are creating a unique copy of the object. If you change the original rowset, the message object is not changed.
Note: You can execute CopyRowsetDeltaOriginal against a message only once. After a message is populated, any other CopyRowsetDeltaOriginal PeopleCode statements are ignored. If you have to populate different levels of a message rowset separately, you can use the CreateRowset method to create a rowset that has the same structure as your message, populate the created rowset, then use CopyRowsetDeltaOriginal to populate your message. You can also use the Rowset CopyTo method to populate a message rowset, then populate the PSCAMA record manually.
Parameters
Parameter |
Description |
---|---|
source_rowset |
Specifies the name of the rowset to be copied into the message object. |
record_list |
Specifies source and target records to be copied into the message object. The target records must be records in your message, while the source records must be records in a rowset that exists in the data buffer and is populated. |
Returns
None.
Example
Function Update_Dir(&MSGName As string)
&MSGName = "OPERATION." | &MSGName;
&MSG = CreateMessage(@(&MSGName));
&PnlRowset = GetLevel0();
&MSG.CopyRowsetDeltaOriginal(&PnlRowset);
%IntBroker.Publish(&MSG);
End-Function;
Syntax
CreateNextSegment()
Description
Use the CreateNextSegment method to divide a message into segments. You generally only divide asynchronous messages that contain a large amount of data. This method is used only when creating a message for publication, not after a message has been published.
Parameters
None.
Returns
None.
Example
See Message Segments.
Syntax
DeleteSegment(SegmentNumber)
Description
Use the DeleteSegment method to delete the specified segment. This method is used only when creating a message for publication, not after a message has been published.
Note: You should use DeleteSegment and UpdateSegment only when writing to memory, or when SegmentsByDatabase is set to False. These methods do not work when writing to the database, or when SegmentsByDatabase is set to True.
Parameters
Parameter |
Description |
---|---|
SegmentNumber |
Specify a number indicating which segment you want to delete from the unpublished message. |
Returns
None.
Syntax
ExecuteEdits([editlevels]);
where editlevels is a list of values in the form:
editlevel1 [+ editlevel2] . . .]);
and where editleveln is one of the following system constants:
%Edit_DateRange
%Edit_OneZero
%Edit_PromptTable
%Edit_Required
%Edit_TranslateTable
%Edit_YesNo
Description
The ExecuteEdits method executes the standard system edits on every field for every record in the message executing the method. All edits are based on the record edits defined for the record that the message is based on. The types of edits performed depends on the editlevel. If no editlevel is specified, all system edits defined for the record definition are executed, that is:
Reasonable Date Range (Is the date contained within plus or minus 30 days from the current date?)
1/0 (Do all 1/0 fields only contain 1 or 0?)
Prompt Table (Is field data contained in the specified prompt table?)
Required Field (Do all required fields contain data? For numeric or signed fields, it checks that they do not contain NULL or 0 values.)
Translate Table (Is field data contained in the translate table?)
Yes/No (Do all yes/no fields only contain only yes or no data?)
Note: ExecuteEdits does not perform any validation on DateTime fields.
If any of the edits fail, the status of the property IsEditError is set to True for the Message Object executing the method, and any Rowset, Row, Record, or Field Objects that could be instantiated from the same data as the Message Object. In addition, the Field class properties MessageNumber and MessageSetNumber are set to the number of the returned message and message set number of the returned message, for the field generating the error.
If you want to check the field values only for a particular record, you can use the ExecuteEdits method with a record object.
In addition, if you want to dynamically set the prompt tables used for a field (with the %EditTable function) you must use the SetEditTable method.
Considerations for ExecuteEdits and SetEditTable
If an effective date is a key on the prompt table, and the record being edited doesn’t contain an effective-dated field, the current date/time is used as the key value.
If a setID is a key on the prompt table, and the record being edited doesn’t contain a setID field, the system looks for the setID on the other records in the current row first, then search parent rows.
Considerations for ExecuteEdits and Numeric Fields
A zero (0) might or might not be a valid value for a numeric field. ExecuteEdits processes numeric fields in different ways, depending on whether the field is required:
If the numeric field is required: 0 is considered invalid.
If the numeric field is not required: 0 is considered valid.
Parameters
Parameter |
Description |
---|---|
editlevel |
Specifies the standard system edits to be performed against every field on every record. If editlevel isn’t specified, all system edits are performed. editlevel can be any of the following system constants:
|
Returns
None.
Example
The following is an example of a call to execute Required Field and Prompt Table edits:
&MSG.ExecuteEdits(%Edit_Required + %Edit_PromptTable);
The following is an example showing how ExecuteEdits() could be used:
&MSG.ExecuteEdits();
If &MSG.IsEditError Then
Exit(1);
End-If;
Syntax
FirstCorrelation()
Description
Use this method within an Integration Broker OnPreNotify event on the subscribing node to determine if this is the first message with this correlation ID.
Parameters
None.
Returns
A Boolean value: True if this is the first message with this correlation ID, False if a previous message with the same correlation ID has already run the OnPreNotify event.
Example
To improve the performance of correlated messages with multiple segments, use the FirstCorrelation method to run the OnPreNotify event for the first correlated message only. On the first message to be published, set the InitializeConversationId property to True. After the message is published, retrieve the transaction ID from the message. This transaction ID should be used to set the conversation ID (that is, the correlation ID) for all subsequent messages to be published.
/* On the first message to be published */
&MSG.InitializeConversationId = True;
%IntBroker.Publish(&MSG);
&strCorrelationID = &MSG.TransactionId;
/* For all subsequent correlated messages */
&MSG.IBInfo.ConversationID = &strCorrelationID;
%IntBroker.Publish(&MSG);
Then, on the subscribing node, use the FirstCorrelation method to run the OnPreNotify event one time only:
If &MSG.FirstCorrelation() = True Then
/* process the OnPreNotify event logic */
End-If;
Syntax
GenXMLPartString(PartIndex)
Description
Use the GenXMLPartString to create an XML string based on the message part specified by PartIndex.
Note: This method only works with rowset-based container messages.
Parameters
Parameter |
Description |
---|---|
PartIndex |
Specify the number of the part that you want to generate an XML string for. |
Returns
An XML string.
Syntax
GenXMLString()
Description
The GenXMLString method creates an XML string based on the message after it's loaded from the message buffer.
Note: This method does not support nonrowset-based messages.
Parameters
None.
Returns
An XML string.
Example
In the following example, the first thee lines of code creates the message object and copies the data from a Component buffer into the message object. The last line creates an XML string based on that message object.
&MSG = CreateMessage(OPERATION.PO_INSERT);
&RS = GetLevel0();
&MSG.CopyRowset(&RS);
&XML_STRING = &MSG.GenXMLString();
Syntax
GetContentString([SegmentIndex])
Description
Use the GetContentString to return a string populated with the content from the specified message segment. If you don't specify a segment, the data from the first segment is used.
Parameters
Parameter |
Description |
---|---|
SegmentIndex |
Specify the message segment that you want to access. |
Returns
A string populated with the content of the specified segment if successful, null otherwise.
Syntax
GetDocument([segmented_messsage])
Description
Use these method to get a Document object associated with this message.
Note: If a fault occurs, continue to use GetContentString to read the fault message, and not GetDocument.
Parameters
Parameter |
Description |
---|---|
segmented_messsage |
Specify a Boolean value indicating whether the message is segmented. |
Returns
A Document object.
Example
Local Message &Msg;
Local Document &Doc;
&Msg = CreateMessage(Operation.QEFLIGHTPLAN_DOC);
&Doc = &Msg.GetDocument( True);
/* populate the document */
...
&Msg.CreateNextSegment();
&Doc = Null;
&Doc = &Msg.GetDocument( True);
/* populate the document */
...
Syntax
GetPartAliasName(PartIndex)
Description
Use the GetPartAliasName to access the alias of the specified message part.
Note: This method works only with container messages.
Parameters
Parameter |
Description |
---|---|
PartIndex |
Specify the message part that you want to access the alias. |
Returns
A string containing the message part alias.
Syntax
GetPartName(PartIndex)
Description
Use the GetPartName method to return the message name of the message specified by PartIndex.
Note: This method works only with container messages.
Parameters
Parameter |
Description |
---|---|
PartIndex |
Specify the number of the message part that you want to get the name for. |
Returns
A string.
Syntax
GetPartRowset(PartIndex)
Description
Use the GetPartRowset to instantiate and populate a rowset object based on the specified message part in a container message.
Note: This method only works with rowset-based container messages.
Parameters
Parameter |
Description |
---|---|
PartIndex |
Specify the number of the message part that you want to instantiate and populate a rowset from. |
Returns
A reference to a rowset object if successful, Null otherwise.
Syntax
GetPartVersion(PartIndex)
Description
Use the GetPartVersion method to return the version number of the message part specified by PartIndex.
Note: This method only works with container messages.
Parameters
Parameter |
Description |
---|---|
PartIndex |
Specify the number of the message part that you want to access the version of. |
Returns
A string containing the version number.
Syntax
GetPartXMLDoc(PartIndex)
Description
Use the GetPartXMLDoc to retrieve the message part data as an XmlDoc object.
Note: This method can only be used for a nonrowset-based message parts.
Parameters
Parameter |
Description |
---|---|
PartIndex |
Specify the message part that you want to access the data for as an XmlDoc object. |
Returns
An XmlDoc object populated with the message part data.
Syntax
GetQueryString(Parameter_Name)
Description
Use the GetQueryString method to obtain the parameter values of a query string.
Note: This method has been deprecated and remains for backward compatibility only. Use the IBConnectorInfo collection GetQueryStringArg method instead.
Parameters
Parameter |
Description |
---|---|
Parameter_Name |
Specify the parameter name you want to obtain. |
Returns
A string containing the value of the parameter.
Example
Local Message &request;
Local Rowset &Rowset;
Local String &emplid;
&request = %IntBroker.GetMessage();
&Rowset = &request.GetRowset();
&emplid = &request.GetQueryString("EMPLID");
Syntax
GetRowset([version])
Description
The GetRowset method returns a standard PeopleCode level zero rowset object for the specified message version. It creates an empty rowset for the specified message version if it doesn’t already exist. If no message version is specified, the default message version is used.
When you use the GetRowset method, you are not creating a unique copy of the object. You are making only a copy of the reference. If you change the rowset, the original message is changed.
Parameters
Parameter |
Description |
---|---|
version |
An optional parameter, specifying an existing message version as a string. If version isn’t specified, the default message version is used. |
Returns
A Rowset object if successful.
Example
The following gets all the SET_CNTRL_REC rows related to the row on the page, then updates the field SETID with the value from the page. GetRowset is used to create a rowset based on the message structure, that is, an unpopulated rowset. Because the rowset is unpopulated, you can use the Fill method to populate with data from the page.
Local Message &MSG;
Local Rowset &MSG_ROWSET;
If FieldChanged(SETID) Then
&MSG = CreateMessage(OPERATION.SET_CNTRL_REC);
&MSG_ROWSET = &MSG.GetRowset();
&MSG_ROWSET.Fill("where SETCNTRLVALUE =:1 and REC_GROUP_ID =:2", SETCNTRLVALUE, REC_GROUP_ID);
For &I = 1 To &MSG_ROWSET.ActiveRowCount
&MSG_ROWSET.GetRow(&I).SET_CNTRL_REC.SETID.Value = SETID;
&MSG_ROWSET.GetRow(&I).PSCAMA.AUDIT_ACTN.Value = "C";
End-For;
%IntBroker.Publish(&MSG);
End-If;
Syntax
GetSegment(SegmentNumber)
Description
Use the GetSegment method to return the specified segment. This method doesn't actually return anything, but populates the current message object with the specified segment's data.
Parameters
Parameter |
Description |
---|---|
SegmentNumber |
Specify the number of the segment you want to access. |
Returns
None.
Syntax
GetURIDocument()
Description
Use this method to retrieve the document template as defined on the service operation.
Parameters
None.
Returns
A Document object.
Example
&MSG = CreateMessage(Message.WEATHERSTATION_GET);
&DOC = &MSG.GetURIDocument();
&COM = &DOC.DocumentElement;
&COM.GetPropertyByName("state").Value = "Washington";
&COM.GetPropertyByName("city").Value = "Redmond";
&COM.GetPropertyByName("day").Value = "today";
&COM.GetPropertyByName("week").Value = "first";
&COM.GetPropertyByName("year").Value = "2010";
&COM.GetPropertyByName("country").Value = "USA";
&MSG.URIResourceIndex = 1;
&bRet = &MSG.IBInfo.LoadRESTHeaders();
&return_message = %IntBroker.SyncRequest(&MSG);
Syntax
GetURIResource([index])
Description
Use this method to retrieve the URI for the representational state transfer (REST) resource based on the specified index.
Parameters
Parameter |
Description |
---|---|
index |
Corresponds to the row number in the URI grid of the REST Resource Definition section of the service operation definition. |
Returns
A string.
Example
&MSG = CreateMessage(Message.WEATHERSTATION_GET);
&DOC = &MSG.GetURIDocument();
&STR = &MSG.GetURIResource(2);
Syntax
GetXmlDoc()
Description
Use the GetXmlDoc method to retrieve the message data as an XmlDoc object.
Note: This method can only be used for a nonrowset-based message. If you use this method with a rowset-based message an error message is returned.
Parameters
None.
Returns
A XmlDoc object.
Syntax
InBoundPublish(PubNodeName)
Description
Use the InBoundPublish method to send an asynchronous message based on a message rowset to simulate an inbound asynchronous request from an external node.
Note: This method has been deprecated and remains for backward compatibility only. Use the IntBroker class InBoundPublish method instead.
Though you are sending a message to yourself, it goes through all the inbound message processing on PubNodeName.
Parameters
Parameter |
Description |
---|---|
PubNodeName |
Specify the name of the node for which you want to test inbound message publishing. |
Returns
None.
Syntax
LoadXMLPartString(PartIndex, XmlString)
Description
Use the LoadXMLPartString method to populate the part of the container message specified by PartIndex with the XML string XmlString.
Note: This method works only with container messages.
Parameters
Parameter |
Description |
---|---|
PartIndex |
Specify the number of the part of the container message that you want to populate with XML data. |
XmlString |
Specify the XML string to be loaded into the message part. |
Returns
None.
Syntax
LoadXMLString(XMLstring)
Description
The LoadXMLString method loads the message object executing the method with the XML string XMLstring.
Parameters
Parameter |
Description |
---|---|
XMLString |
Specify the XML string to be loaded into the message object. |
Returns
None.
Example
&MSG = CreateMessage(OPERATION.PO_HEADER);
&MSG.LoadXMLString(&XML_STRING);
Syntax
OverrideURIResource(string)
Description
Use this method on the subscribing node (the consumer) to override the URI template portion of the generated URL for a REST-based transaction.
Parameters
Parameter |
Description |
---|---|
string |
Specifies the full URL to the REST-based resource. |
Returns
None.
Example
&MSG = CreateMessage(Operation.QE_WEATHERSTATION_CONSUME_GET);
&MSG.OverrideURIResource("http://example.com/PSIGW/RESTListeningConnector/AKTT/WeatherStation.v1/weather/Washington");
Syntax
Publish([NodeName] [, Deferred_Mode] )
Description
The Publish method publishes a message to the application message queue for the default message version.
Note: This method has been deprecated and remains for backward compatibility only. Use the IntBroker class Publish method instead.
This method does not publish the message if the IsActive property is False.
This method publishes a message asynchronously, that is, a reply message is not automatically generated. To publish a message synchronously, use the SyncRequest method.
Note: This method supports nonrowset-based messages only if the data is populated using the SetXmlDoc method.
If the Publish method is called and the message isn't populated (either using SetXmlDoc or one of the rowset methods,) an empty message is published.
The Publish method can be called from any PeopleCode event, but is generally called from an Application Engine PeopleCode step or from a component.
When publishing from a component, you should publish messages only from the SavePostChange event, either from record field or component PeopleCode. This way, if there’s an error in your publish code, the data isn’t committed to the database. Also, since SavePostChange is the last Save event fired, you avoid locking the database while the other save processing is happening.
However, until the message is published, the tables involved with the component are locked and are not saved. To avoid problems with this, specify the Deferred_Mode property as true, so the message is published after the table data has been committed to the database.
Generally, if the message is successfully published, the PubID, and PubNodeName properties are set to the publication ID and publishing system node name, respectively. The only exception is when the Publish is performed as part of your notification PeopleCode. The notification process is always executed in deferred mode, due to performance considerations, and so the PubID is not populated.
Note: If you’re publishing a message from within an Application Engine program, the message won’t actually be published until the calling program performs a Commit.
Parameters
Parameter |
Description |
---|---|
NodeName |
Specify the node to which the message should be published. |
Deferred_Mode |
Specify whether the message should be published immediately or at the end of the transaction. This parameter takes a Boolean value: False, publish the message immediately, or True, defer the publication. The default value is False. |
Returns
None.
Example
The following copies all the data from a page into a message and publishes it.
Local Message &MSG;
Local Rowset &ROWSET;
&MSG = CreateMessage(OPERATION.MESSAGE_PO):
&ROWSET = GetLevel0();
&MSG.CopyRowset(&ROWSET);
&MSG.Publish;
The following is an example of putting the Incremental Publish PeopleCode on a Record at Level 1 (or 2, 3). If you just do the normal publishing PeopleCode, you get as many messages as there are records at that level (because the code fires for each record).
To make sure the code fires only once, use the following code.
/*NAMES.EMPLID.WORKFLOW */
Local Message &MSG;
Local Rowset &RS;
&LEVEL = CurrentLevelNumber();
&CURRENT_ROW = CurrentRowNumber(&LEVEL);
&TOT_ROW = ActiveRowCount(EMPLID);
/* Only Publish the message once for all records on */
/* this level */
If &CURRENT_ROW = &TOT_ROW Then
&MSG = CreateMessage(OPERATION.NAMES);
&RS = GetRowset();
&MSG.CopyRowsetDelta(&RS);
&MSG.Publish();
End-If;
Syntax
SegmentRestart(TransactionID, Segment_index, segmentByDB)
Description
Use the SegmentRestart method to restart a message segment. This is used only in a Application Engine program, and only if check point logic is used.
Parameters
Parameter |
Description |
---|---|
Transaction_ID |
Specify the transaction ID of the message you want to restart. |
Segment_Index |
Specify the number of the segment that you want to restart. |
SegmentByDB |
Specify the segments by database. |
Returns
None.
Syntax
SetContentString(string)
Description
Use this method to set the content for the message segment for a non-rowset-based message only.
Note: An error will occur if SetContentString is used with other message types, such as rowset-based messages, document-based messages, and so on.
Parameters
Parameter |
Description |
---|---|
string |
Specifies the content of the message segment. |
Returns
A Boolean value: True if the message segment was updated, False otherwise.
Example
Local Message &MSG;
Local Document &DOC;
Local Compound &COM, &COM1;
&MSG = CreateMessage(Message.QE_WEATHERSTATION_POST);
&DOC = &MSG.GetURIDocument();
&COM = &DOC.DocumentElement;
&COM.GetPropertyByName("state").Value = "Washington";
&COM.GetPropertyByName("city").Value = "Redmond";
&COM.GetPropertyByName("day").Value = "today";
&COM.GetPropertyByName("week").Value = "first";
&COM.GetPropertyByName("year").Value = "2010";
&COM.GetPropertyByName("country").Value = "USA";
&MSG.URIResourceIndex = QE_FLIGHTDATA.QE_ACNUMBER;
&DOC = CreateDocument("Weather", "WeatherData", "v1");
&COM1 = &DOC.DocumentElement;
&COM1.GetPropertyByName("city").Value = "Troutlake";
&STR1 = %IntBroker.GetURL("WEATHERSTATION_DATA", 2, &DOC);
&strHTML = GetHTMLText(HTML.WEATHER_CITIES, &STR1);
&bRet = &MSG.SetContentString(&strHTML);
Syntax
SetEditTable(%PromptField, RECORD.recordname)
Description
The SetEditTable method works with the ExecuteEdits method. It is used to set the value of a field on a record that has its prompt table defined as %PromptField value. %PromptField values are used to dynamically change the prompt record for a field.
There are several steps to setting up a field so that you can dynamically change its prompt table.
To set up a field with a dynamic prompt table:
Define a field in the DERIVED record called fieldname.
In the record definition for the field that you want to have a dynamic prompt table, define the prompt table for the field as %PromptField, where PromptField is the name of the field that you created in the DERIVED record.
Use SetEditTable to dynamically set the prompt table.
%PromptField is the name of the field on the DERIVED work record. RECORD.recordname is the name of the record to be used as the prompt table.
&MSG.SetEditTable("%EDITTABLE1", Record.DEPARTMENT);
&MSG.SetEditTable("%EDITTABLE2", Record.JOB_ID);
&MSG.SetEditTable("%EDITTABLE3", Record.EMPL_DATA);
&MSG.ExecuteEdits();
Every field on a record that has the prompt table field %EDITTABLE1 will have the same prompt table, such as, DEPARTMENT.
Parameters
Parameter |
Description |
---|---|
%PromptField |
Specifies the name of the field in the DERIVED record that has been defined as the prompt table for a field in a record definition. |
RECORD.recordname |
Specifies the name of the record definition that contains the correct standard system edits to be performed for that field in the message. |
Returns
None.
Syntax
SetQueryString(Parameter_Name, Value)
Description
Use the SetQueryString method to add a parameter value to the query string.
Note: This method has been deprecated and remains for backward compatibility only. Use the IBConnectorInfo class AddQueryStringArg method instead.
Parameters
Parameter |
Description |
---|---|
Parameter_Name |
Specify the name of the parameter that you want to add to the query string, as a string. |
Value |
Specify the value of the parameter you are adding to the query string. |
Returns
None.
Example
Local Message &request;
&request = CreateMessage(OPERATION.QE_SALES_ORDER);
. . .
. . .
&request.SetQueryString("BUYER", "12345");
Syntax
SetRESTCache(&futureDT)
Description
Use the SetRESTCache method to set server-side caching for provider REST GET service operations the OnRequest PeopleCode event. When you set server-side caching, the system caches the entire transactional data for the specific URI resource. Subsequent requests from a client with an identical resource will result in the data being pulled from the cache. The cache expires on the date and time specified by the &futureDT parameter.
You can delete the cache at any time by calling the DeleteRESTCache method.
Parameters
Parameter |
Description |
---|---|
&futureDT |
Specifies a future date and time as a DateTime variable. |
Returns
None.
Example
Local Message &MSG;
Local datetime &dt;
Local string &op, &ver;
&MSG.SetRESTCache(&dt);
&b_ret = %IntBroker.DeleteRESTCache(&op, &ver);
Syntax
SetStatus(Status)
Description
Use the SetStatus method to set the status of a publication or subscription contract, much the same way you do in the message monitor.
Note: This method has been deprecated and remains for backward compatibility only. Use the IntBroker class SetStatus method instead.
You may want to use this method after an end-user has finished fixing any errors in the message data.
You can set the status of a contract to one of the following statuses:
Cancel
Done
Error
New
The method is available only when the message instance has one of the following statuses:
Cancel
Done
Error
New
Parameters
Parameter |
Description |
---|---|
Status |
Specify the status that you want to set the message to. Value are:
|
Returns
None.
Syntax
SetXmlDoc(&XmlDoc)
Description
Use the SetXmlDoc method to load a nonrowset-based message with data from an XmlDoc object.
Note: This method can only be used for nonrowset-based message. If you use this method with a rowset-based message an error message is returned.
Considerations Using SetXmlDoc
In order to wrap non-XML data in cdata wraps as part of a message that would be automatically removed when posted to the gateway, the following cdata wraps are supported:
<?xml version="1.0"?> <data PsNonXml="Yes"><![CDATA..
<?xml version="1.0"?> <data psnonxml="Yes"><![CDATA..
<?xml version="1.0"?><add_some_root_tag> <data PsNonXml="Yes"><![CDATA...
<?xml version="1.0"?><add_some_root_tag> <data psnonxml="Yes"><![CDATA...
Parameters
Parameter |
Description |
---|---|
&XmlDoc |
Specify an already instantiated, populated XmlDoc object. |
Returns
None.
Syntax
SyncRequest([NodeName])
Description
Use the SyncRequest method to send a synchronous message for the default message version.
Note: This method has been deprecated and remains for backward compatibility only. Use the IntBroker class SyncRequest method instead.
Use the IsActive property to determine if a message is active or not before using this method.
This method sends a single message synchronously, that is a reply message is returned as a result of this method.
If you want to publish a message asynchronously, use the Publish method.
If you want to publish more than one message at a time synchronously, use the IntBroker SyncRequest method.
Note: This method supports nonrowset-based messages only if the SetXmlDoc method is used to populate the message prior to using the SyncRequest method.
The SyncRequest method can be called from any PeopleCode event, but is generally called from an Application Engine PeopleCode step or from a component.
When sending a synchronous request from a component, you should send messages only from the SavePostChange event, either from record field or component PeopleCode. This way, if there’s an error in your SyncRequest code, the data isn’t committed to the database. Also, since SavePostChange is the last Save event fired, you avoid locking the database while the other save processing is happening.
If the message is successfully sent, a response message is returned. In addition, the GUID property is updated with a unique identifier.
Parameters
Parameter |
Description |
---|---|
NodeName |
Specify the name of the node that you want to send this message to. |
Returns
A response message.
Example
Local Message &request, &response;
Local Rowset &sales_order;
&sales_order = GetLevel0();
&request = CreateMessage(OPERATION.QE_SALES_ORDER);
&request.CopyRowsetDelta(&sales_order);
&response = &request.SyncRequest();
If (&response.ResponseStatus = 0) Then
/* do processing */
End-If;
Syntax
Update([versionlist])
where versionlist is an arbitrary list of message versions in the following format:
version1 [, version2] . . .
Description
The Update method updates a message in the message queue with the specified message versions.
Note: This method has been deprecated and remains for backward compatibility only. Use the IntBroker class Update method instead.
If versionlist isn’t specified, the default message version is used. This method is commonly used in the OnRouteSend and OnRouteReceive PeopleCode events.
Note: This method does not support nonrowset-based messages. The Update method can't be called from notification PeopleCode.
Parameters
Parameter |
Description |
---|---|
versionlist |
Specify an optional comma-separated list of message versions. If versionlist isn’t specified, the default message version is used. |
Returns
None.
Syntax
UpdateSegment()
Description
Use the UpdateSegment method to update the current segment with data from the message. This method is used only when creating a message for publication, not after a message has been published.
Note: You should use DeleteSegment and UpdateSegment only when writing to memory, or when SegmentsByDatabase is set to False. These methods do not work when writing to the database, or when SegmentsByDatabase is set to True.
Parameters
None.
Returns
None.