[Catalyst] (Catalyst as Communicate tier) XML MODEL

Joel Bernstein joel at fysh.org
Sun Feb 15 13:24:27 GMT 2009


2009/2/15 Mehran Parchebafieh <axon0098 at gmail.com>:
> Hi all,
> I decided to use Catalyst as communicate layer of a project, I need read xml
> and then, serve the data with REST {json} to other.
> How I can define a xml model thro socket or every IPC?
> Actually catalyst placed on middle of an engine and web interface.

I have had great success using Catalyst in SOA deployments to consume
and emit RESTful XML web services.
Given an XSD to describe the input XML, I build a simple standalone
model using Moose, XML::Pastor and LWP::UserAgent.
A quick wave of the C::Model::Adaptor magic wand and I have my XML
web-service model available in Catalyst.

I then use C::Controller::REST to serve this data up to clients with
appropriate serialization. I have an extra View::REST layer I've built
which knows how to serialize objects which support a native
serialization mechanism - e.g. my XML::Pastor document objects can be
serialized as JSON, YAML etc via C::Action::Serialize but they *are*
XML documents deep down and I like to access this native serialization
when possible. This last bit is due a refactor and will hit the CPAN
when I have some tuits.

Does this go any way to answering your question? It wasn't too clear
what you meant about IPC -- do you already have a standalone class
which acts as a client for the webservice you wish to consume? I would
say creating this needs to be your first step - once that's done
Catalyst::Model::Adaptor makes it trivial to integrate with Catalyst.

/joel



More information about the Catalyst mailing list