cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
5237
Views
5
Helpful
1
Comments
pevaneyn
Cisco Employee
Cisco Employee

The following is a perl script to call the retrieveTrafficStats call on the central-manager with ip 1.2.3.4 and using the userid admin password default for the WAE called test-wae for the time period of 12:00 until 14:00 UTC on September 27 2010 for the outgoing optimized traffic per hour.

It is just a simple example client for demonstration purposes, if you break something while using this you get to keep both pieces.


#!/usr/bin/perl

use LWP::UserAgent;

# this is the RPC call:
$xml_file = '<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope
  SOAP-ENV:e
ncodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
  xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
  xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance"
  xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
  xmlns:xsd="http://www.w3.org/1999/XMLSchema"
>
<SOAP-ENV:Header xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
<wsse:Security SOAP-ENC:root="1">
<wsse:UsernameToken>
<wsse:Username xsi:type="xsd:string">admin</wsse:Username>
<wsse:Password xsi:type="xsd:string">default</wsse:Password>
</wsse:UsernameToken>
</wsse:Security>
</SOAP-ENV:Header>
<SOAP-ENV:Body>
<ns1:retrieveTrafficStats xmlns:ns1="http://service.stats.ws.waas.cisco.com" SOAP-ENC:root="1">
<name>test-wae</name>
<objType>wae</objType>
<trafficType>optimized</trafficType>
<direction>outbound</direction>
<timeframe>
<startTime xsi:type="xsd:string">2010-09-27T12:00:00</startTime>
<endTime xsi:type="xsd:string">2010-09-27T14:00:00</endTime>
<frequency xsi:type="xsd:string">lasthour</frequency>
<timezone xsi:type="xsd:string">utc</timezone>
</timeframe>
</ns1:retrieveTrafficStats>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>';


my $server      =  '1.2.3.4';
my $port        =  '8443';
my $RPCPath  =  '/ws/TrafficStats';

my $uri = 'https://' . $server . ':' . $port . $RPCPath;


my $ua = LWP::UserAgent->new;
# we need to authenticate the https connection:
$ua->credentials( "", "TrafficStats", "admin", "default" );

my $header = HTTP::Headers->new;
$header->header('SOAPAction' => '"retrieveTrafficStats"');
# this is to define what SOAP RPC call we are making
my $request = HTTP::Request->new("POST",$uri,$header );
$request->content($xml_file);

my $response = $ua->request($request);

print $response->as_string;
print "\n";


This produces output like:

we got back:
HTTP/1.1 200 OK
Connection: close
Date: Tue, 28 Sep 2010 10:53:42 GMT
Server: Apache/1.3.41 (Unix) mod_ssl/2.8.31 OpenSSL/0.9.8g mod_jk/1.2.15 mod_auth_pam/1.0a
Content-Type: text/xml;charset=UTF-8
Client-Date: Tue, 28 Sep 2010 10:53:43 GMT
Client-Peer: 1.2.3.4:8443
Client-Response-Num: 1
Client-SSL-Cert-Issuer: /C=US/ST=California/L=San Jose/OU=CNBU/O=Cisco Systems, Inc/CN=CDN-WAVE-274-1
Client-SSL-Cert-Subject: /C=US/ST=California/L=San Jose/OU=CNBU/O=Cisco Systems, Inc/CN=CDN-WAVE-274-1
Client-SSL-Cipher: DHE-RSA-AES256-SHA
Client-SSL-Warning: Peer certificate not verified
Client-Transfer-Encoding: chunked

<?xml version='1.0' encoding='UTF-8'?><soapenv:Envelope xm....

Comments
Jesse De Clerck
Cisco Employee
Cisco Employee

Great doc Peter!

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community: