Online Accounting Software Forums KashFlow Discussion Forums
Forum Login
 
  Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
 

Go Back   Online Accounting Software Forums > Developers Forum

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 18th June 2009, 12:31 PM
Junior Member
 
Join Date: Jun 2009
Posts: 3
Default Perl example using SOAP::LITE

Hi,

For those of you interested, here's how to connect via SOAP::Lite:

Code:
#!/usr/bin/perl 
#===============================================================================
#
#         FILE:  invoices.pl
#
#        USAGE:  ./invoices.pl
#
#  DESCRIPTION:  KashFLow API to check and generate invoices
#
#      OPTIONS:  ---
# REQUIREMENTS:  ---
#         BUGS:  ---
#        NOTES:  ---
#       AUTHOR:  Gavin Henry (GH), <ghenry@suretecsystems.com>
#      COMPANY:  Suretec Systems Ltd.
#      VERSION:  1.0
#      CREATED:  17/06/09 14:00:32 BST
#     REVISION:  ---
#===============================================================================

use strict;
use warnings;
use Data::Dumper;

# By default, SOAP::Lite generates a SOAPAction header with the structure of
# [URI]#[method]. We need KashFlow/method, hence we use on_action
#
use SOAP::Lite on_action => sub { sprintf '%s/%s', @_ };

# Need tomake sure they are definitely strings.
my $user = SOAP::Data->type('string')->name( UserName => 'suretec' );
my $pass = SOAP::Data->type('string')->name( Password => 'testing_password' );

my $kfapi =
  SOAP::Lite->uri('KashFlow')
  ->proxy('https://secure.kashflow.co.uk/api/service.asmx')->on_fault(
    sub {
        my ( $soap, $res ) = @_;
        die ref $res ? $res->faultdetail : $soap->transport->status, "\n";
    }
  );

my $cust_email =
  SOAP::Data->type('string')
  ->name( CustomerEmail => 'enquiries@suretecsystems.com' );
my $cust = $kfapi->GetCustomerByEmail( $user, $pass, $cust_email )->result;

print 'Customers name is ' . $cust->{'Name'}, "\n" if $cust;
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT. The time now is 05:16 AM.

 

Powered by vBulletin® Version 3.7.1
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.1.0