package MyApp::ForeignSource::SOAP;
# Some object system… Moose/Mouse/Class::Accessor
use SOAP::Lite;
# Collection of methods and attributes for running SOAP requests
# and returning the data in nice perl structures or with iterators
# and helpers like Data::Page.
1;
####
package MyApp::FSS;
use parent "Catalyst::Model::Adaptor";
__PACKAGE__->config( class => "MyApp::ForeignSource::SOAP" );
# If the arguments to MyApp::ForeignSource::SOAP
# are a hash ref, you’re probably done.
1;
####
---
# myapp.yml
Model::FSS:
args:
service: http://soap.example.org/srvc.wsdl
et: cetera
####
package MyApp::Controller::SomeClass;
use Moose;
use namespace::autoclean;
BEGIN { extends "Catalyst::Controller" }
sub index :Path :Args(0) {
my ( $self, $c ) = @_;
my $pref = $c->user->search_related("prefs", {type => "soap"});
my $fss = $c->model("FSS");
my $stuff = $fss->call("fooBar", $fss->data->name("key")->value($pref->value));
die $stuff->faultstring if $stuff->fault;
$c->stash( result => $stuff->result );
}
__PACKAGE__->meta->make_immutable;
1;