[Catalyst] consuming Webservices with Catalyst?

Joel Bernstein joel at fysh.org
Mon Nov 23 13:39:39 GMT 2009

2009/11/23 Jens Schwarz <blacky6767 at gmx.de>:
> 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:
> 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.


More information about the Catalyst mailing list