Edward Kawas
and 1 contributors


LS::Service - Base class for authority, metadata, and data services


 # Import standard service framework
 use LS::Service::Authority;
 use LS::Service::DataService;
 use LS::Service::Fault;
 use LS::Service::Response;

 # Use the LS::SOAP::Service subclass to create a SOAP based service
 # that executes in a standard HTTP / CGI environment
 use LS::SOAP::Service transport=> 'HTTP::CGI';

 my $location = 'http://localhost:80';

 # Create the authority service
 my $authority = new LS::Service::Authority(name=> 'i3cauthority', 
                                            getAvailableServices=> \&custom_service_ports,
                                            authority=> 'i3c.org');
 $authority->add_port(type=> $LS::Authority::WSDL::METADATA_PORT,
                      protocol=> $LS::Authority::WSDL::Constants::Protocols::SOAP,
                      location=> "$location/metadata/");

 # Add the metadata service with namespaces

 my $metadata = new LS::Service::DataService;
 $metadata->add_namespace(new LS::Service::Namespace(name=> 'formats', 
                                                     data_handler=> \&load_metadata));
 # Create a Service that contains an authority and associated metadata
 my $test_service = new LS::SOAP::Service;

 unless($use_auth) {



 # Authentication handler
 sub auth_me {
        my ($user, $pass) = @_;
        return 1;

 # Metadata handler
 sub load_metadata {

        my ($lsid, $accepted_formats) = @_;

        return LS::Service::Fault->fault('Invalid LSID') if(!$lsid);

        return new LS::Service::Response(type=> 'text/plain',
                                         response=> 'Metadata');

 # Handler that customizes WSDL that describes how to invoke the authority
 sub custom_service_ports {
        my $wsdl = shift;

        $wsdl->add_port(type=> 'HTTPPort',
                        protocol=> $LS::Authority::WSDL::Constants::Protocols::HTTP,
                        location=> "$location/authority/");

        $wsdl->add_port(type=> 'SOAPPort',
                        protocol=> $LS::Authority::WSDL::Constants::Protocols::SOAP,
                        location=> "$location/authority/");

        return $wsdl;


This class provides a set of methods to easily create a full or partial. LSID service Any combination of data, metadata or authority sevices are. supported .


new ( %options )

Use this constructor to create a new service with the following %options keys:

     auth_type: The type of authentication. Currently unused.
     auth_handler: A boolean function that will authenticate the incoming connection.


authorityService ( $LS::Service::Authority )

Enables the authority component of an LSID service to this instance.

dataService ( ref $LS::Service::DataService )

Adds a data component to this LSID service instance.

metadataService ( ref $LS::Service::DataService )

Adds a metadata component to this LSID service instance.


Starts the service and begins accepting requests for resources.


Copyright (c) 2002,2003 IBM Corporation. All rights reserved. This program and the accompanying materials are made available under the terms of the Common Public License v1.0 which accompanies this distribution, and is available at http://www.opensource.org/licenses/cpl.php