Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Catalyst: Users

consuming Webservices with Catalyst?

 

 

Catalyst users RSS feed   Index | Next | Previous | View Threaded


blacky6767 at gmx

Nov 23, 2009, 5:27 AM

Post #1 of 2 (572 views)
Permalink
consuming Webservices with Catalyst?

Hi,

I want to change my Catalyst app so that its data is not written/read to/from my MySQL-DB but to/from Webservices.

I have made a simple test (outside of Catalyst) with SOAP::WSDL that works for "reading" a Webservice. This looks like this:

use MyInterfaces::FooService::FooPortType;

my $user = 'someuser';
my $pass = 'somepass';

*SOAP::Transport::HTTP::Client::get_basic_credentials = sub {
return ($user, $pass);
};

my $s = MyInterfaces::FooService::FooPortType->new();
my $r = $s->Foo( {
'Parameter1' => 'bar',
'Parameter2' => 'baz',
} );
print $r;

But actually I have no clue on how to consume a Webservice "the Catalyst way". The amount of CPAN modules covering SOAP, WSDL, ... is overwhelming and I am kind of lost.

Are there any remommendations - especially with detailed examples? It was hard for me to even get this simple example above working as I am SOAP/WSDL newbie.

Thanks
Jens
--
Jetzt kostenlos herunterladen: Internet Explorer 8 und Mozilla Firefox 3.5 -
sicherer, schneller und einfacher! http://portal.gmx.net/de/go/chbrowser

_______________________________________________
List: Catalyst [at] lists
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst [at] lists/
Dev site: http://dev.catalyst.perl.org/


joel at fysh

Nov 23, 2009, 5:39 AM

Post #2 of 2 (503 views)
Permalink
Re: consuming Webservices with Catalyst? [In reply to]

2009/11/23 Jens Schwarz <blacky6767 [at] gmx>:
> Hi,
>
> I want to change my Catalyst app so that its data is not written/read to/from my MySQL-DB but to/from Webservices.
>
> I have made a simple test (outside of Catalyst) with SOAP::WSDL that works for "reading" a Webservice. This looks like this:
<snip>
> But actually I have no clue on how to consume a Webservice "the Catalyst way". The amount of CPAN modules covering SOAP, WSDL, ... is overwhelming and I am kind of lost.
>
> Are there any remommendations - especially with detailed examples? It was hard for me to even get this simple example above working as I am SOAP/WSDL newbie.

I think you have the right idea. Build a standalone web-service
client. In your example you're using a SOAP service, so I would use
XML::Compile::SOAP and XML::Compile::WSDL11, but you might have good
luck with the SOAP::* modules, I am less familiar with those. Either
way, build a standalone client which you can test on its own. Finally
build a thin Catalyst-aware shim, using Catalyst::Model::Adaptor or
Catalyst::Component::InstancePerContext, which wraps/consumes your
standalone model and captures whatever Catalyst config etc you need to
use your model within Catalyst. This approach may require slightly
more code files than the monolithic approach but will be much simpler
to test since you remove the Catalyst dependency from verifying the
majority of your model's behaviour.

/joel

_______________________________________________
List: Catalyst [at] lists
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst [at] lists/
Dev site: http://dev.catalyst.perl.org/

Catalyst users RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.