NAME
LS::Authority::WSDL::Services - WSDL document describing how to invoke the authority
SYNOPSIS
# Generating WSDL
use LS::Authority::WSDL::Services;
$wsdl = LS::Authority::WSDL::Services->new(
name => 'PDBAuthorityService',
);
$wsdl->add_port(
protocol => $LS::Authority::WSDL::Constants::Protocols::HTTP,
location => 'http://www.authority.org/');
);
$wsdl->add_port(
protocol => $LS::Authority::WSDL::Constants::Protocols::SOAP,
location => 'http://www.authority.org/authority/');
);
print $wsdl->xml;
or
# Parsing WSDL
use LS::Authority::WSDL::Services;
local $/ = undef;
open FILE, 'wsdl.xml';
$xml = <FILE>;
close FILE;
my $wsdl = LS::Authority::WSDL::Services->from_xml($xml);
print "HTTP Ports\n";
$locations = $wsdl->methodLocations('HTTPPort');
if ($locations) {
foreach $loc (@$locations) {
print "\t", $loc->protocol, ': ', $loc->url , "\n";
}
}
print "SOAP Ports\n";
$locations = $wsdl->methodLocations('SOAPPort');
if ($locations) {
foreach $loc (@$locations) {
print "\t", $loc->protocol, ': ', $loc->url , "\n";
}
}
DESCRIPTION
CONSTRUCTORS
The following methods are used to construct a new LS::Authority::WSDL::Services object:
- new ( [%options] )
-
This class method creates a new LS::Authority::WSDL::Services object and returns it. Key/value pair arguments may be provided to initialize locator options. The options can also be set or modified later by method calls described below.
- from_xml ( $xml )
-
This class method creates a new LS::Authority::WSDL::Services object and returns it. The $xml paramater is a string containing a valid WSDL XML document. The newly created object is populated by parsing this XML document.
METHODS
- name ( [$new_name] )
-
Sets and retrieves the descriptive name of the authority service that is creating the WSDL. This name is used to generate identifiers in the WSDL document, so it should be fairly short, and should not contain characters not allowed in XML identifiers, e.g. whitespace.
- add_port ( %keys_and_values )
-
Adds a port to the WSDL document. The port is described by supplying the following possible key/value pairs:
protocol specifies the transport protocol. This can be one of $LS::Authority::WSDL::Constants::Protocols::HTTP, $LS::Authority::WSDL::Constants::Protocols::SOAP.
method specifies the HTTP method to be used, e.g. 'GET' or 'POST'. This defaults to 'GET', and is ignored if the protocol is not $LS::Authority::WSDL::Constants::Protocols::HTTP.
location specifies the location of the port. For HTTP ports this should be the hostname:portnumber. For SOAP ports, this should be the complete HTTP URL. Other SOAP transports are not supported.
expires specifies whether or not an expires header message part will be added to output message bindings for SOAP ports. A true value causes the message part to appear in the bindings. This is ignored if the protocol is not $LS::Authority::WSDL::Constants::Protocols::SOAP.
Examples
$wsdl->add_port( protocol => $LS::Authority::WSDL::Constants::Protocols::HTTP, location => 'www.server-with-object.com'); ); $wsdl->add_port( protocol => $LS::Authority::WSDL::Constants::Protocols::SOAP, location => 'http://www.server-with-object.com/metaDataService/'); );
- method_locations ( $method_name )
-
Returns the locations at which the given method of the resource may be found. The return value is a reference to an array of objects of class
LS::Authority::WSDL::Simple::Location
, or undef if the method is not available. The location objects have three members, as shown in the example.$locations = $wsdl->method_locations('HTTPPort'); if ($locations) { foreach $loc (@$locations) { # a string, either $LS::Authority::WSDL::Constants::Protocols::HTTP, # or $LS::Authority::WSDL::Constants::Protocols::SOAP $protocol = $loc->protocol; $url = $loc->url; # a string if ($protocol eq $LS::Authority::WSDL::Constants::Protocols::HTTP) { $method = $loc->method; # if protocol is HTTP, this is the HTTP method, eg 'GET' } } }
- xml ( )
-
Gets the WSDL document as an XML string.
COPYRIGHT
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