Version
4.0
bool found = false;
foreach( ZXTM.VirtualServerRule r in rules[0] ) {
if( r.name == rule ) {
found = true;
r.enabled = true;
}
}
if( ! found ) {
// Add a new rule to the start of the list
ZXTM.VirtualServerRule[] newrules = new
ZXTM.VirtualServerRule[rules[0].Length + 1];
newrules[0] = new ZXTM.VirtualServerRule();
newrules[0].name = rule;
newrules[0].enabled = true;
newrules[0].run_frequency =
ZXTM.VirtualServerRuleRunFlag.only_first;
Array.Copy( rules[0], 0,
newrules, 1, rules[0].Length );
rules[0] = newrules;
}
p.setRules( new string[] { vsName }, rules );
} catch ( Exception e ) {
Console.WriteLine( "{0}", e );
}
}
}
Notes
The rules manipulation functions take a compound structure which
uses an enumeration named `RunRules'. The SOAP::Lite interface
presents this structure as a standard Perl hash; C# presents it as an
object of type ZXTM.VirtualServerRule.
This example illustrates the shortcomings of SOAP::Lite when it
receives values defined as enumerations in the WSDL interface
43
New Page 1