beautypg.com

Example: unbinding a real server from a vip, Perl example – Brocade Virtual ADX XML API Programmer’s Guide (Supporting ADX v03.1.00) User Manual

Page 859

background image

Brocade Virtual ADX XML API Programmer’s Guide

849

53-1003248-01

Example: Unbinding a real server from a VIP

B

print "\n $xml_result \n";

#### Write Configuration in Memory to the Startup Config File ####

##################################################################

$xml_result = $syssoap->call('urn:writeConfig');

undef $slbsoap;

undef $syssoap;

Example: Unbinding a real server from a VIP

“Perl example”

“Java example”

“C# example”

Perl example

#!/usr/bin/perl -w

# Path to PERL Interpreter - Replace with correct path if different from the one

used above

# Open the Test Case LOG File

open LOG,">Usecase2.log";

# Pre-Requisite PERL Modules

# Install the SOAP and other PERL Modules from CPAN if not pre-installed

(http://perl-begin.org/topics/cpan/life-with-cpan/)

use strict;

use Getopt::Long;

use MIME::Base64;

use XML::Simple;

import SOAP::Data q(name);

import SOAP::Header;

use Time::HiRes q(gettimeofday);

use XML::Twig;

# This is used to capture the SOP Request & Response Data. Do Not Change

use SOAP::Lite +trace => [ transport =>

sub

{

# This is a callback function that will be called just before

# a request is sent and immediately after a response is received

# we will use it to log all SOAP XML to and from the server

my ($http_object) = @_;

# We will either get a HTTP::Request object or a HTTP::Response object

if (ref($http_object) eq "HTTP::Request")

{

# We have a Request object. We need to make it pretty for log readability

my $content = $http_object->content;

my $twig = XML::Twig->new(pretty_print=>'indented');

$twig->parse($content);

$content = $twig->sprint;

print LOG "\nSOAP Request\n------------\n" . $content . "\n\n";

}

elsif (ref($http_object) eq "HTTP::Response")

{

# We have a Response object.