[Catalyst] accessing Webservices?

Joel Bernstein joel at fysh.org
Mon Sep 14 12:28:42 GMT 2009


2009/9/14 Jens Schwarz <blacky6767 at gmx.de>:
> Hi,
>
> I want to get/write some of my application data not from/to my app's MySQL DB, but from/to a webservice.
>
> Are there any reccomendations on how to access SAP webservices with Catalyst applications?
>
> I recently succeeded accessing them with a plain perl script using SOAP::WSDL, but do not know on how to accomplish this inside of my Cat app.
>
> (I looked into C::M::SOAP but had some difficulties integrating it into my App. Are there some more examples?)

For the SOAP interface, I'd look at using XML::Compile, with which I
have had good results.

As for how to architect this, consider not "how would I build this in
Catalyst" but "how would I build this standalone". Both from a
perspective of layered design, and of testing, this will simplify your
efforts.

Once you have a standalone package wrapping your SOAP API and any
client-side business logic, wrap this up into a Catalyst model. You
may get good mileage with C::Model::Adaptor (or one of the other
patterns in its dist, e.g. ::Factory::PerRequest, if you need
per-request SOAP connection semantics) or by writing your own model
package that uses ACCEPT_CONTEXT to extract config etc from the
Catalyst context object. Also look at the
C::Component::InstancePerContext role, if you need per-request model
instantiation / configuration.

/joel



More information about the Catalyst mailing list