summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIvan Kohler <ivan@freeside.biz>2014-01-25 16:55:43 -0800
committerIvan Kohler <ivan@freeside.biz>2014-01-25 16:55:43 -0800
commitfc79953ad4a0b0438d963a6bcdb011d20279a7d8 (patch)
treee951ff43681c216cc235d64280efed635668214a
parent920293158ad908105cf20f047794a30ca39a64f3 (diff)
initial version appears to be hooked up and working against dev sandbox
-rw-r--r--lib/Net/VoIP_Innovations.pm103
1 files changed, 8 insertions, 95 deletions
diff --git a/lib/Net/VoIP_Innovations.pm b/lib/Net/VoIP_Innovations.pm
index 01affe2..b24f590 100644
--- a/lib/Net/VoIP_Innovations.pm
+++ b/lib/Net/VoIP_Innovations.pm
@@ -105,100 +105,13 @@ sub AUTOLOAD {
my @soap_opts = map { SOAP::Data->name($_)->value( $opts->{$_} ) }
keys %$opts;
- my $result = SOAP::Lite
- ->proxy($URI)
- #->uri($NS)
- ->default_ns($NS)
- ->on_action( sub { join '/', @_ } )
- ->$function( @soap_opts )
- ->result();
-
- #warn Dumper($result);
-
-}
-
-=cut
-
-sub PROTOTYPE_AUTOLOAD {
- my $w = new XML::Writer(OUTPUT => \$output, DATA_MODE => 1, DATA_INDENT => 3);
-
- $w->xmlDecl('ISO-8859-1');
- $w->doctype('request', undef, $URL);
-
- $w->startTag('request', 'id' => ''); #XXX request ID???
- $w->startTag('header');
- $w->startTag('sender');
-
- if ( $self->{'sessionid'} ) {
-
- #$w->dataElement( 'login' => '' );
- #$w->dataElement( 'password' => '' );
- $w->dataElement( 'sessionid' => $self->{'sessionid'} );
-
- } else {
-
- $w->dataElement( 'login' => $self->{'login'} );
- $w->dataElement( 'password' => $self->{'password'} );
- #$w->dataElement( 'sessionid' => '' );
-
- }
-
- $w->endTag('sender');
- $w->endTag('header');
-
- $w->startTag('body');
-
- $w->dataElement( 'requesttype' => $function );
-
- if ( keys %$opts ) {
- $w->startTag('item');
- foreach my $opt ( keys %$opts ) {
- $w->dataElement( $opt => $opts->{$opt} );
- }
- $w->endTag('item');
- }
-
- $w->endTag('body');
-
- $w->endTag('request');
-
- #$output =~ s/\n+/\n/g;
-
- warn "XML Request for $function function:\n$output"
- if $self->{'debug'} > 1;
-
- my( $page, $response, %reply_headers ) = https_post(
- 'host' => $HOST,
- 'port' => $PORT,
- 'path' => ($PATH||443),
- 'args' => { 'apidata' => $output, },
- #'content' => $output,
- #'Content-Type' => 'text/plain',
- #'Content-Type' => 'text/xml',
- 'Content-Type' => 'application/xml',
- #'headers' => {},
- 'debug' => ( $self->{'debug'} > 1 ? 1 : 0 ),
- );
-
- unless ( $response =~ /^200/i ) {
- $self->{'errstr'} = $response;
- return '';
- }
-
- warn "XML Response for $function function:\n: $page"
- if $self->{'debug'} > 1;
-
- my $hashref = XMLin( $page );
-
- warn "Parsed response for $function funtion:\n". Dumper($hashref)
- if $self->{'debug'} > 1;
-
- my $return = $hashref->{'body'};
-
- warn "Returning data:\n". Dumper($return)
- if $self->{'debug'} > 1;
-
- $return;
+ SOAP::Lite
+ ->proxy($URI)
+ #->uri($NS)
+ ->default_ns($NS)
+ ->on_action( sub { join '/', @_ } )
+ ->$function( @soap_opts )
+ ->result();
}
@@ -250,7 +163,7 @@ L<http://search.cpan.org/dist/Net-VoIP_Innovations>
=head1 COPYRIGHT & LICENSE
-Copyright 2014 Freeside Internet Services, Inc. (http://freeside.biz/)
+Copyright 2008-2014 Freeside Internet Services, Inc. (http://freeside.biz/)
This program is free software; you can redistribute it and/or modify it
under the same terms as Perl itself.