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

Page 829

Advertising
background image

Brocade Virtual ADX XML API Programmer’s Guide

819

53-1003248-01

Example: Adding and binding a real server and a VIP

B

# 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 = $syssoap->call('urn:writeConfig');

# 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 "Time taken to Write Configuration to Startup Config file:

$response_time\n";

print LOG "===== Operation Complete =====\n\n";

# Close the Log file

undef $slbsoap;

undef $syssoap;

close LOG;

Java Example

package adx;

/**

*

* Include the following jar files in Java project

* 1.axis.jar

* 2.commons-discovery-0.2.jar

* 3.commons-logging-1.1.1.jar

* 4.jaxrpc.jar

* 5.wsdl4j-1.5.1.jar

* 6.adx-wsdl.jar (Use axis to generate jar from SYS-service and SLB-service

WSDLs)

*

* * Flow *

* // Initialize SYS Service

* // Initialize SLB Service

* // Call api's

*/

import java.net.MalformedURLException;

import java.net.URL;

import java.rmi.RemoteException;

import javax.xml.rpc.ServiceException;

import javax.xml.rpc.Stub;

import org.apache.axis.MessageContext;

import org.apache.axis.transport.http.HTTPConstants;

import com.brocade.slb.connector.webservicesapi.AdcSlbLocator;

import com.brocade.slb.connector.webservicesapi.AdcSlbServicePortType;

import com.brocade.slb.connector.webservicesapi.AdcSysInfoLocator;

import com.brocade.slb.connector.webservicesapi.AdcSysInfoServicePortType;

import

com.brocade.slb.connector.webservicesapi.BindRealServerPortToVipPort_datatype;

import com.brocade.slb.connector.webservicesapi.CreateRealServerPort_datatype;

import com.brocade.slb.connector.webservicesapi.CreateRealServer_datatype;

import com.brocade.slb.connector.webservicesapi.CreateVirtualServerPort_datatype;

Advertising