Using client script to host xml configuration

To make an appserver rule configurable, we often need to store some parameters as a separate xml file. The only problem with this approach is that we have to remember to copy the xml file to the (production) server.

In Pivotal, the more practical way to store the configuration is to host the xml string inside a client script. Since the client script is part of the BM, it will always be available and there is no special deployment required.

Below is the example on how to retrieve xml configuration from a client script.

<?xml version="1.0" encoding="utf-8"?>
  <logging logFile = "D:\PivotalLog.txt" logLevel = "2">

Fig. Sample of XML Configuration hosted as a client script

string ClientScriptMapping = "CMS_Config";
string mapping = 
string logSettingString = 
    XmlDocument xd = new XmlDocument();
    string xPathString = "/config/logging";
    XmlNode xNode = xd.SelectSingleNode(xPathString);
    logFile = xNode.Attributes["logFile"].Value;
    logSettingString = xNode.Attributes["logLevel"].Value;
    logSetting = (LogLevel)Convert.ToUInt16(logSettingString);

Fig. .NET ASR to retrieve xml string a client script

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: