Programmer's Guide (Supporting ADX v03.1.00) Manual

Brocade Virtual ADX XML API Programmer’s Guide 851
53-1003248-01
Example: Unbinding a real server from a VIP
B
# Use the stored values if they are not meant to be overridden
# Values can be hard-coded here too, instead of passing in CLI
$dut = "10.37.53.198" if ($dut eq "");
$username = "admin" if ($username eq "");
$password = "brocade" if ($password eq "");
$context= "" if ($context eq "");
$transport = "http" if ($transport eq "");
# Create a SOAP Object to connect to the SOAP Service on the DUT
my $slbsoap = SOAP::Lite->new (proxy => "$transport://$dut/WS/SLB");
my $syssoap = SOAP::Lite->new (proxy => "$transport://$dut/WS/SYS");
# Transport header with network credential
eval
{
$slbsoap->transport->http_request->header('Authorization:' => 'Basic ' .
encode_base64("$username:$password"));
$syssoap->transport->http_request->header('Authorization:' => 'Basic ' .
encode_base64("$username:$password"));
};
# Set the URN and other properties of the SOAP Object
$slbsoap->uri('urn:webservicesapi');
$slbsoap->ns('urn:webservicesapi', 'urn');
$slbsoap->outputxml('true'); # Set this to false if SOM object is required instead
of XML output.
$slbsoap->envprefix('slbsoapenv');
$slbsoap->encprefix('slbsoapenc');
$slbsoap->autotype (0);
$syssoap->uri('urn:webservicesapi');
$syssoap->ns('urn:webservicesapi', 'urn');
$syssoap->outputxml('true'); # Set this to false if SOM object is required instead
of XML output.
$syssoap->envprefix('slbsoapenv');
$syssoap->encprefix('slbsoapenc');
$syssoap->autotype (0);
my $request_time;
my $response_time;
my $xml_result;
my @slbsoap_body;
# Build the SOAP Header using the Context Name
my $slbsoap_header = SOAP::Header->name('urn:RequestHeader' =>
\SOAP::Header->value(SOAP::Header->name('context' => "$context")));
#### Unbind the Real Server Port from the Virtual Server ####
############################################################
# Build the SOAP Request Message with the XML Context and Header
@slbsoap_body = (name('realServerPort')->value([
name('ServerPortSequence')->value([
name('port')->value([
name('NameOrNumber')->value('http')
]),
name('srvr')->value([
name('Name')->value('RealServer-001')
])
])
]),
name('virtualServerPort')->value([
name('port')->value([
name('NameOrNumber')->value('http')
]),
name('srvr')->value([
name('Name')->value('VirtualServer-001')
])