package Integrations::AngusSOAP; # Generated by SOAP::Lite (v0.715) for Perl -- soaplite.com # Copyright (C) 2000-2006 Paul Kulchenko, Byrne Reese # -- generated at [Thu Dec 17 15:16:47 2015] # -- generated from https://webserviceslive.angus.gov.uk/acwebservices.cfc?wsdl # -- generated with the stubmaker.pl script from SOAP::Lite # Angus provide endpoints for testing and production, make sure we're using the right one. use FixMyStreet; my $TEST_ENDPOINT = 'https://webservicestest.angus.gov.uk/acwebservices.cfc'; my $LIVE_ENDPOINT = 'https://webserviceslive.angus.gov.uk/acwebservices.cfc'; my $ENDPOINT = FixMyStreet->config('STAGING_SITE') ? $TEST_ENDPOINT : $LIVE_ENDPOINT; # It can be helpful to override the endpoint URL e.g. for dev or testing $ENDPOINT = FixMyStreet->config('ANGUS_ENDPOINT') ? FixMyStreet->config('ANGUS_ENDPOINT') : $ENDPOINT; my %methods = ( 'GetLocaleInfo' => { endpoint => $ENDPOINT, soapaction => '', namespace => 'http://DefaultNamespace', parameters => [ SOAP::Data->new(name => 'authenticationtoken', type => 'xsd:string', attr => {}), SOAP::Data->new(name => 'uprn', type => 'xsd:string', attr => {}), ], # end parameters }, # end GetLocaleInfo 'AuthenticateJADU' => { endpoint => $ENDPOINT, soapaction => '', namespace => 'http://DefaultNamespace', parameters => [ ], # end parameters }, # end AuthenticateJADU 'CreateServiceRequest' => { endpoint => $ENDPOINT, soapaction => '', namespace => 'http://DefaultNamespace', parameters => [ SOAP::Data->new(name => 'authenticationtoken', type => 'xsd:string', attr => {}), SOAP::Data->new(name => 'CallerId', type => 'xsd:string', attr => {}), SOAP::Data->new(name => 'CallerAddressId', type => 'xsd:string', attr => {}), SOAP::Data->new(name => 'DeliveryId', type => 'xsd:string', attr => {}), SOAP::Data->new(name => 'DeliveryAddressId', type => 'xsd:string', attr => {}), SOAP::Data->new(name => 'CRMRequestType', type => 'xsd:string', attr => {}), SOAP::Data->new(name => 'JADUXFormRef', type => 'xsd:string', attr => {}), SOAP::Data->new(name => 'PaymentRef', type => 'xsd:string', attr => {}), SOAP::Data->new(name => 'JADUFormFields', type => 'xsd:string', attr => {}), ], # end parameters }, # end CreateServiceRequest 'PropertySearch' => { endpoint => $ENDPOINT, soapaction => '', namespace => 'http://DefaultNamespace', parameters => [ SOAP::Data->new(name => 'authenticationtoken', type => 'xsd:string', attr => {}), SOAP::Data->new(name => 'postcode', type => 'xsd:string', attr => {}), SOAP::Data->new(name => 'streetname', type => 'xsd:string', attr => {}), SOAP::Data->new(name => 'town', type => 'xsd:string', attr => {}), SOAP::Data->new(name => 'UPRN', type => 'xsd:string', attr => {}), SOAP::Data->new(name => 'USRN', type => 'xsd:string', attr => {}), ], # end parameters }, # end PropertySearch 'CreateCustomer' => { endpoint => $ENDPOINT, soapaction => '', namespace => 'http://DefaultNamespace', parameters => [ SOAP::Data->new(name => 'authenticationtoken', type => 'xsd:string', attr => {}), SOAP::Data->new(name => 'title', type => 'xsd:string', attr => {}), SOAP::Data->new(name => 'forename', type => 'xsd:string', attr => {}), SOAP::Data->new(name => 'surname', type => 'xsd:string', attr => {}), SOAP::Data->new(name => 'uprn', type => 'xsd:string', attr => {}), SOAP::Data->new(name => 'HouseNo', type => 'xsd:string', attr => {}), SOAP::Data->new(name => 'HouseName', type => 'xsd:string', attr => {}), SOAP::Data->new(name => 'StreetName', type => 'xsd:string', attr => {}), SOAP::Data->new(name => 'Locale', type => 'xsd:string', attr => {}), SOAP::Data->new(name => 'Town', type => 'xsd:string', attr => {}), SOAP::Data->new(name => 'County', type => 'xsd:string', attr => {}), SOAP::Data->new(name => 'Northing', type => 'xsd:string', attr => {}), SOAP::Data->new(name => 'Easting', type => 'xsd:string', attr => {}), SOAP::Data->new(name => 'postcode', type => 'xsd:string', attr => {}), SOAP::Data->new(name => 'email', type => 'xsd:string', attr => {}), SOAP::Data->new(name => 'telephone', type => 'xsd:string', attr => {}), ], # end parameters }, # end CreateCustomer ); # end my %methods use SOAP::Lite; use Exporter; use Carp (); use vars qw(@ISA $AUTOLOAD @EXPORT_OK %EXPORT_TAGS); @ISA = qw(Exporter SOAP::Lite); @EXPORT_OK = (keys %methods); %EXPORT_TAGS = ('all' => [@EXPORT_OK]); sub _call { my ($self, $method) = (shift, shift); my $name = UNIVERSAL::isa($method => 'SOAP::Data') ? $method->name : $method; my %method = %{$methods{$name}}; $self->proxy($method{endpoint} || Carp::croak "No server address (proxy) specified") unless $self->proxy; my @templates = @{$method{parameters}}; my @parameters = (); foreach my $param (@_) { if (@templates) { my $template = shift @templates; my ($prefix,$typename) = SOAP::Utils::splitqname($template->type); my $method = 'as_'.$typename; # TODO - if can('as_'.$typename) {...} my $result = $self->serializer->$method($param, $template->name, $template->type, $template->attr); push(@parameters, $template->value($result->[2])); } else { push(@parameters, $param); } } $self->endpoint($method{endpoint}) ->ns($method{namespace}) ->on_action(sub{qq!"$method{soapaction}"!}); $self->serializer->register_ns("http://schemas.xmlsoap.org/wsdl/soap/","wsdlsoap"); $self->serializer->register_ns("http://DefaultNamespace","intf"); $self->serializer->register_ns("http://xml.apache.org/xml-soap","apachesoap"); $self->serializer->register_ns("http://rpc.xml.coldfusion","tns1"); $self->serializer->register_ns("http://DefaultNamespace","impl"); $self->serializer->register_ns("http://schemas.xmlsoap.org/wsdl/","wsdl"); $self->serializer->register_ns("http://schemas.xmlsoap.org/soap/encoding/","soapenc"); $self->serializer->register_ns("http://www.w3.org/2001/XMLSchema","xsd"); my $som = $self->SUPER::call($method => @parameters); if ($self->want_som) { return $som; } UNIVERSAL::isa($som => 'SOAP::SOM') ? wantarray ? $som->paramsall : $som->result : $som; } sub BEGIN { no strict 'refs'; for my $method (qw(want_som)) { my $field = '_' . $method; *$method = sub { my $self = shift->new; @_ ? ($self->{$field} = shift, return $self) : return $self->{$field}; } } } no strict 'refs'; for my $method (@EXPORT_OK) { my %method = %{$methods{$method}}; *$method = sub { my $self = UNIVERSAL::isa($_[0] => __PACKAGE__) ? ref $_[0] ? shift # OBJECT # CLASS, either get self or create new and assign to self : (shift->self || __PACKAGE__->self(__PACKAGE__->new)) # function call, either get self or create new and assign to self : (__PACKAGE__->self || __PACKAGE__->self(__PACKAGE__->new)); $self->_call($method, @_); } } sub AUTOLOAD { my $method = substr($AUTOLOAD, rindex($AUTOLOAD, '::') + 2); return if $method eq 'DESTROY' || $method eq 'want_som'; die "Unrecognized method '$method'. List of available method(s): @EXPORT_OK\n"; } 1;