Perl for Windows/Unix Snippet

This code snippet references the ABAService Web Service only. To reference the ABAExpress Web Service, change the $uri, $proxy and $namespace values to the following: $uri = "https://www.lyonsreg.com/webservices/abaexpress/ABAService"; $proxy = "https://www.lyonsreg.com/webservices/abaexpress/ABAService.asmx"; $namespace = "http://www.lyonsreg.com/WebService/ABAService";
'''''''''''''''''''''''''''''''''
#!/usr/local/bin/perl

use SOAP::Lite;


#
# First, retrieve the SOAP service
#

$uri = "http://www.lyonsreg.com/WebService/ABAService";
$proxy = "http://www.lyonsreg.com/webservices/aba/ABAService.asmx";
$namespace = "http://www.lyonsreg.com/WebService/ABAService";

$service = SOAP::Lite
    -> uri($uri)
    -> proxy($proxy)
    -> on_action(sub{sprintf '%s/%s', @_ })
#    -> on_debug(sub{print@_})  # Really useful for debugging sessions
    ;

#
# Now, let's set up the call for the log in.  We have to set the namespace, otherwise
# Soap::Lite inserts a "namesp1" namespace which the ASP service doesn't like.
#
$method = SOAP::Data->name('Logon')->attr({xmlns => $namespace});

$companyID = 2069;
$username = "java";
$password = "java";

@params = ( SOAP::Data->name('companyID' => $companyID)->type('int'),
  SOAP::Data->name('userName' => $username)->type('string'),
  SOAP::Data->name('password' => $password)->type('string')
  );

$som = $service->call($method => @params);

if ($som->fault) {
    print "We got a SOAP fault:\n";
    print "  faultcode:   ". $som->faultcode ."\n"; 
    print "  faultstring: ". $som->faultstring ."\n"; 
    print "  faultactor:  ". $som->faultactor ."\n"; 
    print "  faultdetail: ". $som->faultdetail ."\n"; 
    exit();
}

# We got in, so let's record the sesson token

$token = $som->result;
print "Logon() gave us the token: " . $token . "\n";

#
# Now, let's check an ABA number with "VerifyABA"
#

$method = SOAP::Data->name('VerifyABA')->attr({xmlns => $namespace});

$aba = "101101109";

@params = ( SOAP::Data->name('token' => $token)->type('string'),
  SOAP::Data->name('aba' => $aba)->type('string')
  );

$som = $service->call($method => @params);

if ($som->fault) {
    print "We got a SOAP fault:\n";
    print "  faultcode:   ". $som->faultcode ."\n"; 
    print "  faultstring: ". $som->faultstring ."\n"; 
    print "  faultactor:  ". $som->faultactor ."\n"; 
    print "  faultdetail: ". $som->faultdetail ."\n"; 
    exit();
}

$verify_aba_response = $som->result;
print "verifyABA() returned: " . $verify_aba_response ."\n";

#
# Now, let's logoff
#

$method = SOAP::Data->name('Logoff')->attr({xmlns => $namespace});

@params = ( SOAP::Data->name('token' => $token)->type('string')
  );

$som = $service->call($method => @params);

if ($som->fault) {
    print "We got a SOAP fault:\n";
    print "  faultcode:   ". $som->faultcode ."\n"; 
    print "  faultstring: ". $som->faultstring ."\n"; 
    print "  faultactor:  ". $som->faultactor ."\n"; 
    print "  faultdetail: ". $som->faultdetail ."\n"; 
    exit();
}

print "Successfully logged out\n";
Other Sample Code Snippets Complete source code for the above sample applications and other platform variations is available upon request.  Contact us for more information.
© 2012 Lyons Commercial Data. All rights reserved                                                 Home | Developer Area | Glossary | Contact Us | Privacy | Site Map