diff options
author | Dave Arter <davea@mysociety.org> | 2015-12-17 17:07:58 +0000 |
---|---|---|
committer | Dave Arter <davea@mysociety.org> | 2016-03-29 17:49:37 +0100 |
commit | 58a000d3095f0d3d327365af0f6d7bb4178bb5bb (patch) | |
tree | fca4112eb6f9a79031de4473ea721026e6b13b22 /perllib/Integrations | |
parent | ecb7e0ff7f75344d313c152a47790b32cbcf32b4 (diff) |
[Angus] SOAP interface/send method for Angus CRM
Diffstat (limited to 'perllib/Integrations')
-rw-r--r-- | perllib/Integrations/AngusSOAP.pm | 168 | ||||
-rw-r--r-- | perllib/Integrations/EastHantsWSDL.pm | 70 |
2 files changed, 238 insertions, 0 deletions
diff --git a/perllib/Integrations/AngusSOAP.pm b/perllib/Integrations/AngusSOAP.pm new file mode 100644 index 000000000..5f100993b --- /dev/null +++ b/perllib/Integrations/AngusSOAP.pm @@ -0,0 +1,168 @@ +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; diff --git a/perllib/Integrations/EastHantsWSDL.pm b/perllib/Integrations/EastHantsWSDL.pm new file mode 100644 index 000000000..b35309c3d --- /dev/null +++ b/perllib/Integrations/EastHantsWSDL.pm @@ -0,0 +1,70 @@ +package Integrations::EastHantsWSDL; + +# -- generated by SOAP::Lite (v0.60) for Perl -- soaplite.com -- Copyright (C) 2000-2001 Paul Kulchenko -- +# -- generated from http://www.easthants.gov.uk/forms.nsf/InputFeedback?WSDL [Thu Oct 16 12:31:57 2008] + +my %methods = ( + INPUTFEEDBACK => { + endpoint => 'http://91.224.27.33/forms.nsf/InputFeedback?OpenWebService', + soapaction => 'INPUTFEEDBACK', + uri => 'urn:DefaultNamespace', + parameters => [ + SOAP::Data->new(name => 'STRSERVICENAME', type => 'xsd:string', attr => {}), + SOAP::Data->new(name => 'STRREMOTECREATEDBY', type => 'xsd:string', attr => {}), + SOAP::Data->new(name => 'STRSALUTATION', type => 'xsd:string', attr => {}), + SOAP::Data->new(name => 'STRFIRSTNAME', type => 'xsd:string', attr => {}), + SOAP::Data->new(name => 'STRNAME', type => 'xsd:string', attr => {}), + SOAP::Data->new(name => 'STREMAIL', type => 'xsd:string', attr => {}), + SOAP::Data->new(name => 'STRTELEPHONE', type => 'xsd:string', attr => {}), + SOAP::Data->new(name => 'STRHOUSENONAME', type => 'xsd:string', attr => {}), + SOAP::Data->new(name => 'STRSTREET', type => 'xsd:string', attr => {}), + SOAP::Data->new(name => 'STRTOWN', type => 'xsd:string', attr => {}), + SOAP::Data->new(name => 'STRCOUNTY', type => 'xsd:string', attr => {}), + SOAP::Data->new(name => 'STRCOUNTRY', type => 'xsd:string', attr => {}), + SOAP::Data->new(name => 'STRPOSTCODE', type => 'xsd:string', attr => {}), + SOAP::Data->new(name => 'STRCOMMENTS', type => 'xsd:string', attr => {}), + SOAP::Data->new(name => 'STRFURTHERINFO', type => 'xsd:string', attr => {}), + SOAP::Data->new(name => 'STRIMAGEURL', type => 'xsd:string', attr => {}), + ], + }, +); + +use SOAP::Lite; # +trace => [qw(debug)]; +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]); + +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->proxy($method{endpoint} || Carp::croak "No server address (proxy) specified") unless $self->proxy; + my @templates = @{$method{parameters}}; + my $som = $self + -> endpoint($method{endpoint}) + -> uri($method{uri}) + -> on_action(sub{qq!"$method{soapaction}"!}) + -> call($method => map {@templates ? shift(@templates)->value($_) : $_} @_); + UNIVERSAL::isa($som => 'SOAP::SOM') ? wantarray ? $som->paramsall : $som->result + : $som; + } +} + +sub AUTOLOAD { + my $method = substr($AUTOLOAD, rindex($AUTOLOAD, '::') + 2); + return if $method eq 'DESTROY'; + + die "Unrecognized method '$method'. List of available method(s): @EXPORT_OK\n"; +} + +1; |