package Bric::SOAP; require Bric; our $VERSION = Bric->VERSION; # load em' up use Bric::SOAP::Handler; use Bric::SOAP::Story; use Bric::SOAP::Media; use Bric::SOAP::Template; use Bric::SOAP::Workflow; use Bric::SOAP::ATType; use Bric::SOAP::Category; use Bric::SOAP::MediaType; use Bric::SOAP::Site; use Bric::SOAP::Keyword; use Bric::SOAP::User; use Bric::SOAP::Desk; use Bric::SOAP::ElementType; use Bric::SOAP::OutputChannel; use Bric::SOAP::ContribType; use Bric::SOAP::Destination; use Bric::SOAP::Preference; 1; __END__ =head1 NAME Bric::SOAP - The Bricolage SOAP interface =head1 VERSION $LastChangedRevision$ =head1 DATE $LastChangedDate: 2006-03-15 12:37:12 +0100 (Wed, 15 Mar 2006) $ =head1 SYNOPSIS use Bric::SOAP; =head1 DESCRIPTION This module serves as a root class for the Bric::SOAP classes. It also contains the functional and technical specifications for the Bricolage SOAP interface. =head1 Functional Specification The Bricolage SOAP interface expose key Bricolage systems to automation. This section describes intended functionality -- implementation details are described below in the L. =head2 Supported Functionality The Bricolage SOAP interface supports the following features: =over 4 =item Stories and Media Clients can create new stories and media and update existing stories and media in the system. Clients can also export existing stories and media in the format accepted for creation. Finally, clients may delete stories or media. =item Element Types Clients can create, update, delete and export element types. =item Templates Clients can create, update, delete and export templates. =item Workflow Clients can move stories and media between desks. Clients can also publish stories and media and deploy templates. =back =head2 Use Cases The functionality described above exposes a great deal power. Here are some potential use cases: =over 4 =item Importing Content From Legacy Systems Using the Story and Media interfaces, content can be moved from legacy CMS systems into Bricolage. =item Automated Publishing With access to workflow and publishing, one can write an auto-publishing daemon that publishes a selection of stories on a schedule. =item Story and Media Synchronization It is often desirable to move stories and media between instances of Bricolage. The SOAP interface can be used by a clients to automatically synchronize stories and media in a group of Bricolage instances. Synchronization can be made according to selection criteria similar to that exposed by the C method in Bricolage classes. =item Element and Template Distribution A centrally-developed library of elements and templates has many advantages. With the SOAP interface, one can automatically update Bricolage instances with new versions of elements and templates. =item XML Syndication An XML syndication system can be written to pull stories from the SOAP interface and transform them into the target XML DTD. Syndication can also be accomplished using output channels and templates. =back =head1 Technical Specification This section describes the implementation of the Bricolage SOAP functional specification described above. =head2 Technologies =over 4 =item SOAP Bricolage provides a SOAP 1.1 compatible interface. See L for the SOAP specification. The SOAP server uses use the SOAP::Lite (L) for its SOAP implementation. Clients may use any SOAP 1.1 compatible library, although only SOAP::Lite clients have been tested during development. =item XML Schema The format of XML documents used by the SOAP interface are specified in XML Schema format. See L for more information on this format. The schema is L. =back =head2 Modules The following modules support the SOAP interface. See the documentation for each module for interface details, including XML Schemas and SOAP client examples. =over 4 =item L This module provides the Apache/mod_perl SOAP handler. It is responsible for dispatching requests to individual Bric::SOAP modules. =item L Handles authentication for SOAP clients. Authentication will be cookie-based -- clients can call a C function and get an HTTP cookie to use with calls to the other SOAP interfaces. =item L Provides query, export, update, create, and delete for Story objects. =item L Provides query, export, update, create, and delete for Media objects. =item L Provides query, export, update, create, and delete for Templates. =item L Provides query, export, update, create, and delete for Element types. =item L Provides query, export, update, create, and delete for Category objects. =item L Provides query, export, update, create, and delete for MediaType objects. =item L Provides query, export, update, create, and delete for Site objects. =item L Provides query, export, update, create, and delete for Keyword objects. =item L Provides query, export, update, create, and delete for User objects. =item L Provides query, export, update, create, and delete for Desk objects. =item L Provides the ability to move Story, Media and Template objects between desks. Also provides checkin, checkout, publish, and deploy. And now list_ids, export, create, update, and delete. =item L Provides query, export, update, create, and delete for Element Type Set objects. =item L Provides query, export, update, create, and delete for OutputChannel objects. =item L Provides query, export, update, create, and delete for ContribType objects. =item L Provides query, export, update, create, and delete for Destination objects. =item L Provides query, export, update, create, and delete for Preference objects. =back =head2 SOAP Details All of the Bricolage SOAP modules described above share a common SOAP serialization strategy described here. =over 4 =item Namespace The namespace for all Bric::SOAP calls is: http://bricolage.sourceforge.net To specify a module within that namespace, append the pieces as path components. For example, to call methods in Bric::SOAP::Story use the namespace: http://bricolage.sourceforge.net/Bric/SOAP/Story For the SOAP::Lite users in the audience, this is the "uri" setting. =item Parameters All Bric::SOAP methods use a named-parameter style call syntax. This syntax is mapped to XML elements where the name is the name of the element and the value is the value contained inside the element. For example, a Perl call like: Bric::SOAP::Story->list_ids({ title => '%foo%', publish_status => 1 }); Is called through SOAP as: %foo% 1 SOAP::Lite clients can generate this call using C to name the parameters: import SOAP::Data 'name'; my $result = $soap->list_ids(name(title => '%foo%'), name(publish_status => 1) ); In most cases, Perl doesn't distinguish between strings and numbers. When writing a SOAP client you should feel free to type your parameters in whatever way makes most sense in your implementation language. =item Return Values All Bric::SOAP methods return a single named parameter. If a method needs to return multiple values then a SOAP array is returned containing the values. For example, C<< Bric::SOAP::Story->list_ids() >> returns a list of story IDs in this structure: 1027 1028 1029 1030 And an empty response returns an empty array: SOAP::Lite clients can access this return value as an array reference: my $story_ids = $response->result; foreach my $id (@$story_ids) { frobnicate($id); } =item XML Document Encoding The Bric::SOAP system uses complete XML documents as parameters and return values to many methods (C and C, for example). These documents must be encoded in Base64 for performance reasons. See the PERFORMANCE section of the L documentation for a full explanation of why this is necessary. This is not a limitation of SOAP::Lite in particular but the explanation is particularly lucid. For SOAP::Lite clients, generating Base64 parameters is very easy: my $document = name(document => $xml)->type('base64'); And on decoding, returned base64 will be done automatically. The XML Schema for these documents is included below. =item Error Handling Errors are returned as SOAP faults using fault strings produced by the method called. If you use SOAP::Lite as your client library you can check for errors using the C method and access the error message with C: my $response = $soap->list_ids(...); die "SOAP Error: " . $response->faultstring if $response->fault; =item XML Schema For Asset Documents This is the XML Schema for asset documents used in the Bricolage SOAP interface. The XSD source: a set of Bricolage assets omitted if no expire date omitted if not published omitted if not published This is just a list of keyword names. if we ever start using the full capabilities of Bric::Biz::Keyword then this will need expansion. It would probably make sense to do a Bric::SOAP::Keyword in that case. This is incomplete... Either this element should be expanded to properly serialize all the available contributor data or it should reference a top-level contributor element serviced by Bric::SOAP::Contrib. omitted if no expire date omitted if not published This is incomplete... Either this element should be expanded to properly serialize all the available contributor data or it should reference a top-level contributor element serviced by Bric::SOAP::Contrib. omitted if no expire date omitted if not deployed This is just a list of keyword names. if we ever start using the full capabilities of Bric::Biz::Keyword then this will need expansion. It would probably make sense to do a Bric::SOAP::Keyword in that case. This is just a list of keyword names. if we ever start using the full capabilities of Bric::Biz::Keyword then this will need expansion. It would probably make sense to do a Bric::SOAP::Keyword in that case. This is just a list of extensions. password isn't implemented yet A list of output channels for template includes. An element data container - a recursive type. =back =head2 Example Asset Documents Here's a simple story with some keywords and no contributors: Default Site Story One a description of story one one /2004/02/22/one 3 0 1 Internal 2004-02-22T22:18:00Z / Web key one key two deck one para one para two inset copy =head2 Example Clients =over 4 =item Command-Line Client This script -- F -- provides command-line access to all available SOAP methods. For more information read the C manual by running: bric_soap --man or, if Bricolage's bin directory isn't in your path: /usr/local/bricolage/bin/bric_soap --man =item Auto-Publisher A script that publishes a set of stories based on a simple criteria entered on the command line. Designed to be used in cron jobs.. See F in F for an implementation that republishes already published stories. More general automated publishing can be performed through F. =item Dev Sync Tool A script that grabs the element tree and templates from a source server and updates a list of target servers to match. See F in F for a complete implementation. =back =head1 SEE ALSO L L L L L L L L L L L L L L L L L L L L L =head1 AUTHOR Sam Tregar =cut