The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

PPM::SOAPServer - SOAP server for PPM repository

SYNOPSIS

  use SOAP::Transport::HTTP::CGI;
  my $safe_classes = {
    'PPM::SOAPServer' => undef,
    };
  SOAP::Transport::HTTP::CGI->handler( $safe_classes );

DESCRIPTION

PPM::SOAPServer is a module that provides an implementation of a SOAP server to hold the PPM repository. Note that it is not required that you actually instantiate a copy of the server object yourself; the SOAP modules will take care of this for you when they instantiate the SOAP server. All of the 'search*' methods that are provided by this module are made available through the SOAP interface and can be accessed through a SOAP client.

METHODS

new ()

Instantiates a new PPM::SOAPServer object, returning a reference to the newly created object to the caller. During instantiation, we also read in a full copy of the information held within the repository so that we can run queries against it later.

handle_request ($hdrs, $body, $envelope)

Handles the complete request provided through the SOAP interface. This method determines which method is to be invoked and calls off to that method to generate the response which is to be returned to the caller. Once the response has been generated, we stuff this back into the envelope so that it can be returned via the SOAP server.

version ()

Returns to the caller the version number of the SOAP server that is running.

searchAbstract ($params)

Searches against the 'ABSTRACT' field within the packages held in the repository. Within the given parameters, a key of "search" should be provided containing the term to search for (which can be a regex). If no "search" key is provided, a complete list of all of the packages are returned to the caller.

The return value provided from this method will be a reference to a hash containing the result set. A key named "num_results" will be provided, stating the number of results to be found in the result set. Each item in the result set will be named "result_???" where '???' is the number of that item in the result set. For example, a search returning two results would return a reference to a hash with keys of 'num_results', 'result_1', and 'result_2'.

searchAuthor ($params)

Searches against the 'AUTHOR' field within the packages held in the repository. Within the given parameters, a key of "search" should be provided containing the term to search for (which can be a regex). If no "search" key is provided, a complete list of all of the packages are returned to the caller.

The return value provided from this method will be a reference to a hash containing the result set. A key named "num_results" will be provided, stating the number of results to be found in the result set. Each item in the result set will be named "result_???" where '???' is the number of that item in the result set. For example, a search returning two results would returns a reference to a hash with keys of 'num_results', 'result_1', and 'result_2'.

searchTitle ($params)

Searches against the 'TITLE' field within the packages held in the repository. Within the given parameters, a key of "search" should be provided containing the term to search for (which can be a regex). If no "search" key is provided, a complete list of all of the packages are returned to the caller.

The return value provided from this method will be a reference to a hash containing the result set. A key named "num_results" will be provided, stating the number of results to be found in the result set. Each item in the result set will be named "result_???" where '???' is the number of that item in the result set. For example, a search returning two results would returns a reference to a hash with keys of 'num_results', 'result_1', and 'result_2'.

search ($params)

Searches against _all_ of the fields within the packages held in the repository. Within the given parameters, a key of "search" should be provided containing the term to search for (which can be a regex). If no "search" key is provided, a complete list of all of the packages are returned to the caller.

The return value provided from this method will be a reference to a hash containing the result set. A key named "num_results" will be provided, stating the number of results to be found in the result set. Each item in the result set will be named "result_???" where '???' is the number of that item in the result set. For example, a search returning two results would returns a reference to a hash with keys of 'num_results', 'result_1', and 'result_2'.

packages ()

Generates a list of all of the packages currently available in the repository.

The return value provided from this method will be a reference to a hash containing the result set. A key named "num_results" will be provided, stating the number of results to be found in the result set. Each item in the result set will be named "result_???" where '???' is the number of that item in the result set. For example, a repository with two packages in it would return a reference to a hash with keys of 'num_results', 'result_1', and 'result_2'.

fetch_ppd ($params)

Fetches the PPD from our package list for a specific package. The parameters provided should include a key named 'package', which is the name of the package for which we wish to fetch the PPD for. This method returns to the caller a hash reference containing the matching results. A key named "num_results" will be present stating the number of matching results (either 0 or 1). If a PPD has been found for the requested package, a key of "result_1" will also be present, whose value will be the full contents of the PPD file (in XML format) as a scalar value.

fetch_summary ()

Fetches a summary of the entire contents of the repository. This method returns to the caller a reference to a hash containing the following keys: 'num_results', 'result_1'. The value of the 'result_1' key is the full contents of the repository summary file (in XML format) as a scalar value.

_xml_escape ($val)

INTERNAL METHOD. Cheap little function to escape out most of the things in the value we're passing back so that its at least "clean". This should really be using some sort of XML::Entities module to do the conversion, though; I've just hacked this together because these are the things that I encountered.

_search ($field, $search)

INTERNAL METHOD. Does a general search against the fields present for a package within the repository, searching for a specific term (which could be a regex). If no '$field' value is provided, this method searches through _all_ of the fields present for a given package. If no '$search' value is provided, '.*' is deemed to be the matching regex (everything).

The return value provided from this method will be a reference to a hash containing the result set. A key named "num_results" will be provided, stating the number of results to be found in the result set. Each item in the result set will be named "result_???" where '???' is the number of that item in the result set. For example, a search returning two results would returns a reference to a hash with keys of 'num_results', 'result_1', and 'result_2'.

_pkginfo ($package)

INTERNAL METHOD. Takes the XML object representation of a package and turns it into a single hash reference containing only select portions of the package information. This hash reference is then returned to the caller.

_loadRepository ()

INTERNAL METHOD. Loads up information about the contents of the repository, stuffing them into the global namespace. If the repository has already been loaded, this method simply returns without doing anything. NOTE, that this method is _NOT_ an instance method; it's a package method.

AUTHOR

Graham TerMarsch (gtermars@home.com)

SEE ALSO

PPM::SOAPClient, SOAP.