Understanding the GetClientPolicies.aspx calls

book

Article ID: 179695

calendar_today

Updated On:

Products

Management Platform (Formerly known as Notification Server)

Issue/Introduction

 

Resolution

Question
Can I get information on how to understand the GetClientPolicies.aspx URL call that the NSAgent makes in order to request an Altiris Agent configuration update?

Answer
 

Altiris Agent configuration update interface

Item name: GetClientPolicies.aspxIIS:           
./Altiris/NS/AgentNTFS:          
%ProgramFiles%\Altiris\Notification Server\AgentCodeBehind: 
Altiris.Web.NS.Agent.GetClienPoliciesAssembly: bin/Altiris.Web.NS.Agent.dll

Parameters:

Mandatory: Xml or WrkstaGuidOptional: Hash, ConfigVersion, Compress, WrkstaName

Usage:

The Altiris Agent sends a http get request to this page with  the required parameters (theWrkstatGuid is the 
only required field and can be either in the http “Xml” parameter or inthe “WrkstaGuid” parameter, all other 
parameters are optional).A GetClientPolicies object is then instantiated and calls upon various internal 
resources before returning the client policies in either a string format (xml/text, if the Compress parameter 
is not set to “True”, “1”, or “Yes”) or a binary format (if the Compressparameter is present in the request 
and set to “True”, “1” or “Yes”). The content of the string or binary stream will be either an error message 
or a new policies string. If this is the case the agent will replace its policy file (saved on the 
"%ProgramFiles%\Altiris\Altiris Agent\Client Policies" folder named following the format 
"<ns_server_fqdn>.xml").


Class overview:

public class GetClientPolicies : Page     {           // Methods           
public GetClientPolicies();           
private void InitializeComponent();           
protected override void OnInit(EventArgs e);           
private void Page_Load(object sender, EventArgs args);           
private void ParseClientRequest(ref string xml, ref string configVersion, ref string hash, ref bool compress);           
// Fields           
private const string m_sampleRequestError = <string truncated – see error message details below>     }

Object process overview:

The GetClientPolicies object is instantiated when the GetClientPolicies.aspx page is loaded onIIS (upon client 
request). It derives from the System.Web.UI.Page class. 

After the standardinitialisation the Page_Load method is called.This method first retrieves the NS Version 
from the InstallationManager (namespace =Altiris.NS.Installation; assembly = Altiris.NS.dll).

If the http request includes parameters it calls the private method ParseClientRequest andpasses various 
string and bool refs to it. The ParseClientrequest method gathers theparameters passed by the agent into the 
http get request and format them into a single xmlstring as shown in the example below:

<Request       configVersion="2"       compress="true"       
hash="A101703831F7843F170EF9BBFDD24ACE">       <WrkstaGuid>               
{9DC639C3-85F2-498A-BE73-9E4F35EAAE67}       </WrkstaGuid></Request>

An instance of the ClientConfigManager (namespace = Altiris.NS; assembly = Altiris.NS.dll) is requested from 
the AeXActivator (a custom object broker built around the System.Activator).It then uses the 
ClientConfigManager to retrieve the Client policy calling either theGetCompressedClientConfigFromRequest 
method or the GetClientConfigFromRequest method. 

Both methods call the ClientConfigManager.GetClientConfig method.Once all of this is done without raising 
exceptions the object returns the configuration xmlstring in compressed or uncompressed format using the 
Response method implemented in the Pageclass.


Standard responses:

Type 1: the configuration has not changed.<error number="1" nsVersion="<ns server version"><![CDATA[ 
The client config has not changed since the last request (Resource: {<resource guid>})]]>  </error>
Type 2: the configuration has changed.<A standart Client Policy string is returned. 
For examples check on a live system in theclient policy folder.>

Error Message:

The client policies request XML is invalid.GetClientPolicies request format: 
GetClientPolicies.aspx?xml=<<BODY>>where <<BODY>> is:<Request        configVersion="2"        
compress="true|false"        hash="hash">        <WrkstaGuid>                <<RESOURCE>>        
</WrkstaGuid></Request>XML Attributes:  
     
configVersion - Specifies the version of the client policies request XML.
The default value is 2 for NS 6.0. This attribute is optional.       
compress - Specifies whether the response should be compressed.The default value is false. This attribute is 
optional.       
hash - Specifies the hash of the last get client policies response. Thisvalue is used to determine whether the 
client policies have changed since thelast request. This attribute is optional.
XML Elements:<<RESOURCE>> - Specifies the GUID of the resource (Agent) to examine.This element is mandatory.
Example:<Request        configVersion="2"        compress="true"        
hash="A101703831F7843F170EF9BBFDD24ACE">        <WrkstaGuid>                
{9DC639C3-85F2-498A-BE73-9E4F35EAAE67}        </WrkstaGuid></Request>