Advanced Polling Example

Top  Previous  Next

PageGate's GetASCII module can be configured to read any ascii formatted content, regardless of whether that content is a stream of text or a formatted language like HTML, XML, Jave, etc. In this example, you'll be going through how to configure PageGate to read XML content but you can use these steps just as easily for HTML, JSON or another ascii text formatted language by replacing the XML flags with the appropriate language's flags/tags/statements/etc.

 

First, we'll need to create a basic polling directory and get the module online:

1)In Windows, create a sub-directory of your PageGateData folder and name it ASCII

Note: This is arbitrary and you can name the folder whatever you like). For example, if you're using PageGate's default directories, you would create C:\PageGateData\ASCII\

2)Open the PG Admin.

3)Go to Interfaces - GetASCII - Settings.

4)Set the "Polling Directory" to the ASCII folder you created in step 1. By default, C:\PageGateData\ASCII\

5)Check Enabled.

6)Click Apply.

7)When prompted, you do want to enable this for all existing groups and recipients.

8)Go to Program - Settings.

9)In "Run on this server", check GetASCII

10) Click Apply.

11) When prompted for credentials, please reference the Windows Credentials section of the Run Style documentation.

12) When "Switching Run Styles" goes away, open the Windows Services list

 

Next, we'll need to configure the GetASCII module to process your XML content:

 

1)Go to Interfaces - GetASCII - Settings - Advanced Polling - Files.

2)Click Add.

3)Specify the following:

Recipient: *

From: Enter a sender's value. CAD, for example.

File(s): If you want the program to read all XML files from the folder, use *.xml

If you want the program to only read for a specific file name, use filename.xml

Combinations of the two are allowed. For example, you could use 2017*.xml and the program would only look for files that began with 2017 and had an extension of xml.

Path: Enter the directory the .xml files will be in.

File Type: Custom

 

4)Click Apply.

5)Click Apply.

6)Go to Interfaces - GetASCII - Settings - Advanced Polling - Record

7)Specify the following:

Start Pattern: *

Start Offset: 0

 

End Pattern: ~

End Offset: 0

 

General Notes: This effectively tells PageGate that the data to be processed is the first character in the file until the last character of the file.

 

8)Click Apply.

9)Go to Interfaces - GetASCII - Settings - Advanced Polling - Recipient.

10) If you want all of the processed content always delivered to the same recipient or group, select Static Recipient and select the recipient or group to which these messages should be delivered.

 

If there is an XML tag that denotes who these messages should go to, select Dynamic Recipient and specify the following:

 

Start Pattern: <YourRecipientXMLTag>

Start Offset: Set this to the number of characters contained in your xml tag. For example, if your XML tag is <Recipient>, you would set Start Offset to 11 as there are 11 characters in <Recipient>.

 

End Pattern: </YourRecipientXMLTag>

End Offset: 0

 

11) Click Apply.

12) Go to Interfaces - GetASCII - Settings - Advanced Polling - Sender.

13) Select Static Sender and enter a value in to the Sender's Name field. For example, you could use CAD.

14) Click Apply.

15) Go to Interfaces - GetASCII - Settings - Advanced Polling - Message.

16) Select Dynamic Message and specify the following:

If the entire message is contained within a single XML tag, you would specify the following:

Start Pattern: <XMLMessageTag>

Start Offset: 0

 

End Pattern: </XMLMessageTag0>

End Offset: 0

 

For example, let's say that your message is contained in XML content like this:

<Message>The entire body of the message is contained in this field.</Message>

 

You would use the following:

Start Pattern: <Message>

Start Offset: 0

 

End Pattern: </Message>

End Offset: 0

 

As another example, let's say your message is containex in XML content like this:

<Message>

<line1>Relevant data</line1>

<line2>More relevant data</line2>

<irrelevant_data>Value</irrelevant_data>

<irrelevant_data>Value</irrelevant_data>

<line3>More relevant data</line3>

</Message>

 

You would use this:

Start Pattern: <Message>

Start Offset: 0

 

End Pattern: </Message>

End Offset: 0

 

 

If the message is contained across multiple XML tags with no over-arching header tag, you would specify the following:

 

Start Pattern: <FirstRelevantTag>

Start Offset: 0

 

End Pattern: </LastRelevantTag>

End Offset: 0

 

For example, let's say your message is contained in XML content like this:

<message_line_1>First line of the message</message_line_1>

<irrelevant_data>Value</irrelevant_data>

<irrelevant_data>Value</irrelevant_data>

<message_line_2>Second line of the message</message_line_2>

<message_line_3>Third line of the message<message_line_3>

 

You would use the following:

Start Pattern: <message_line_1>

Start Offset: 0

 

End Pattern: </message_line_3>

End Offset: 0

 

17) Check "Use Lookup Table". This function will allow us to remove the raw text XML tags from the text to be delivered.

18) Click Edit Table.

19) Click Add.

General Notes: The Data In value represents the data you want either removed or modified. If you want the data removed, eave the Data Out field completely empty.

 

For example, if you wanted to change every instance of the word pecans to the word oranges, you would use this:

Data In: *pecans*

Data Out: oranges

 

However, if you wanted to remove every instance of the word pecans, you would use this:

Data In: *pecans*

Data Out:

 

To make this a bit more relevant for XML content, however, let's say we wanted to completely remove an entire XML statement as it didn't contain any relevant data. We would use this:

 

Data In: *<value>*</value>*

Data Out:

 

With that, we're telling PageGate to completely remove the entire XML statement from the text processed. For example, *<DATE>*</DATE>* tells PageGate that there isn't any relevant data in the <DATE> tag and to simply remove the entire section from what needs to be delivered.

 

As another example, if you want the data in the <ServerName> tag but you don't want the actual text <ServerName> to appear in the text delivered, you would use this:

 

Data In: *<ServerName>*

Data Out:

 

and you would want to add an additional entry to remove the </ServerName> closing tag:

 

Data In: *</ServerName>*

Data Out:

 

Just to note, anything expressed as a \XXX value is an ASCII code (http://www.asciitable.com/). For example, \009 is a tab, \013 is a carriage return and \010 is a line feed.

 

For example, if you want PageGate to replace all instances of three carriage return/line feed statements in a row and with a single carriage return/line feed, you would use this:

Data In: *\013\010\013\010\013\010*

Data Out: \013\010

 

As another example, if you want to remove all tabs from the data, you would use this:

Data In: *\009*

Data Out:

20) After you've added the necessary entries, click on Apply.

21) Click Apply.