beautypg.com

Perl example – Brocade Virtual ADX XML API Programmer’s Guide (Supporting ADX v03.1.00) User Manual

Page 857

background image

Brocade Virtual ADX XML API Programmer’s Guide

847

53-1003248-01

Example - Binding a real server port to a virtual server port and saving to the startup configuration file

B

objUtils.GetSLBObject().deleteRealServer(objServer);

WriteObject("\r\nDeletion of real server has been completed

successfully.");

}

}

}

Example - Binding a real server port to a virtual server port
and saving to the startup configuration file

Perl example

#!/usr/bin/perl -w

use SOAP::Lite;

use MIME::Base64;

import SOAP::Data q(name);

import SOAP::Header;

my $dut = shift;

my $username = shift;

my $password = shift;

my $context = shift;

# Create a SOAP Object to connect to the SOAP Service on the DUT

my $slbsoap = SOAP::Lite->new (proxy => "http://$dut/WS/SLB");

my $syssoap = SOAP::Lite->new (proxy => "http://$dut/WS/SYS");

# Transport header with network credential

$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 isrequired instead

of XML output.

$syssoap->envprefix('slbsoapenv');

$syssoap->encprefix('slbsoapenc');

$syssoap->autotype (0);

my $xml_result;

# Build the SOAP Header using the Context Name

my $slbsoap_header = SOAP::Header->name('urn:RequestHeader' =>

\SOAP::Header->value(SOAP::Header->name('context' => "$context")));

#### Create a Real Server ####