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

816 Brocade Virtual ADX XML API Programmer’s Guide
53-1003248-01
Example: Adding and binding a real server and a VIP
B
##############################
# Build the SOAP Request Message with the XML Context and Header
my @slbsoap_body = (name('configurationInfo')->value([
name('RealServerConfigurationSequence')->value([
name('description')->value('Real Server 001'),
name('realServer')->value([
name('IP')->value('100.10.1.1'),
name('Name')->value('RealServer-001')
])
])
]));
print LOG "Creating Real Server\n";
# Note the time before making a SOAP Request
$request_time = &start_timer;
# Make the SOAP Call and store the XML result in a variable
# Response is stored in "$xml_result" as XML. Further action can be taken based on
the Response Content.
$xml_result =
$slbsoap->call('urn:createRealServerWithConfiguration',@slbsoap_body,$slbsoap_hea
der);
# Get the elapsed time (Time taken for the SOAP Response to arrive after the
request was sent)
$response_time = &get_elapsed_time($request_time);
# Write the Time taken to the Test Case LOG File
print LOG "SOAP Response Time for Creating the Real Server: $response_time\n";
print LOG "===== Operation Complete =====\n\n";
#### Create a Real Server Port ####
###################################
# Build the SOAP Request Message with the XML Context and Header
@slbsoap_body = (name('portConfig')->value([
name('RealServerPortConfigurationSequence')->value([
name('serverPort')->value([
name('port')->value([
name('NameOrNumber')->value('http')
]),
name('srvr')->value([
name('IP')->value('100.10.1.1'),
name('Name')->value('RealServer-001')
])
])
])
]));
print LOG "Creating Real Server Port\n";
# Note the time before making a SOAP Request
$request_time = &start_timer;
# Make the SOAP Call and store the XML result in a variable
# Response is stored in "$xml_result" as XML. Further action can be taken based on
the Response Content.
$xml_result =
$slbsoap->call('urn:createRealServerPortWithConfiguration',@slbsoap_body,$slbsoap
_header);