#!/usr/bin/perl use strict; use warnings; use SOAP::Lite; # connection settings my %conf=(); $conf{SOAP_PROTO}='http'; $conf{SOAP_HOST}='172.16.8.15'; $conf{SOAP_PORT}='448'; $conf{SOAP_FORMAT}='%s://%s:%d/SOAP'; $conf{SOAP_WSDL_FILE}='../soapapi.wsdl'; # defining some useful constants. $conf{REQUIRED_API_VERSION}="2.6.0"; $conf{VAP_GLOBAL}="Global"; $conf{EQUIPMENT_ID}="EQPT_1"; $conf{COUNTRY_CODE}="CANADA"; # values $conf{USER}="Test01"; $conf{PASS}="123456"; if ($conf{SOAP_PROTO}=~/^https?$/) { my $url = sprintf($conf{SOAP_FORMAT}, $conf{SOAP_PROTO}, $conf{SOAP_HOST}, $conf{SOAP_PORT}); my $soap = SOAP::Lite->uri($conf{SOAP_WSDL_FILE})->proxy($url); my $rc = $soap->GetSOAPVersion(); test_error($rc); if ($rc->result!~/\Q$conf{REQUIRED_API_VERSION}/) { die sprintf( "Incorrect SOAP API version found: <%s> - expecting <%s>\n", $rc->version, $conf{REQUIRED_API_VERSION} ); } print("AddUserAccount\n"); $rc = $soap->AddUserAccount("username" => $conf{USER}, "password" => $conf{PASS}, "activeState" => 1, "accessControlledState" => 1); test_error($rc); print("UpdateVirtualSCLocalUser\n"); $rc = $soap->UpdateVirtualSCLocalUser("Internetzugang",$conf{USER},$conf{PASS},60,0,1); test_error($rc); } else { printf("%s not supported\n",$conf{SOAP_PROTO}); } sub test_error { my $rc=shift; die(sprintf("ERROR(%s) %s\n",$rc->faultcode,$rc->faultstring)) if($rc->fault); }