beautypg.com

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

Page 15

background image

Brocade Virtual ADX XML API Programmer’s Guide

5

53-1003248-01

Creating client-specific APIs from client stubs

1

The following output results from the execution of the "getChassisInfo.pl" script:

C:\>getChassisInfo.pl

Chassis Model : SI-1216-4-PREM

Chassis Serial : E2SA02F038

The contents of the “getChassisInfo.pl” script are as follows:

use SOAP::Lite;

my $soap = SOAP::Lite

-> uri('urn:webserviceapi')

-> proxy('http://username:[email protected]/WS/SYS')

-> ns('urn:webservicesapi','urn');

my $result = $soap->getChassis();

unless ($result->fault)

{

print "\nChassis Model : "

.$result->valueof('//chassisData/identification/model');

print "\nChassis Serial : "

.$result->valueof('//chassisData/identification/serialNum')

} else

{

print join ', ',

$result->faultcode,

$result->faultstring;

}

import java.io.*;

import java.net.*;

import java.util.*;

import org.apache.soap.*;

import org.apache.soap.rpc.*;

public class Example1_client {

public static void main (String[] args)

throws Exception {

System.out.println("\n\nCalling the SOAP Server to say hello\n\n");

URL url = new URL (args[0]);

String name = args[1];

Call call = new Call ( );

call.setTargetObjectURI("urn:Example1");

call.setMethodName("sayHello");

call.setEncodingStyleURI(Constants.NS_URI_SOAP_ENC;);

Vector params = new Vector ( );

params.addElement (new Parameter("name", String.class, name, null));

call.setParams (params);

System.out.print("The SOAP Server says: ");