NAME
SOAP::WSDL::Definitions - model a WSDL >definitions< element
DESCRIPTION
METHODS
first_service get_service set_service push_service
Accessors/Mutators for accessing / setting the >service< child element(s).
find_service
Returns the service matching the namespace/localname pair passed as arguments.
my $service = $wsdl->find_service($namespace, $localname);
first_binding get_binding set_binding push_binding
Accessors/Mutators for accessing / setting the >binding< child element(s).
find_service
Returns the binding matching the namespace/localname pair passed as arguments.
my $binding = $wsdl->find_binding($namespace, $localname);
first_portType get_portType set_portType push_portType
Accessors/Mutators for accessing / setting the >portType< child element(s).
find_portType
Returns the portType matching the namespace/localname pair passed as arguments.
my $portType = $wsdl->find_portType($namespace, $localname);
first_message get_message set_message push_message
Accessors/Mutators for accessing / setting the >message< child element(s).
find_service
Returns the message matching the namespace/localname pair passed as arguments.
my $message = $wsdl->find_message($namespace, $localname);
first_types get_types set_types push_types
Accessors/Mutators for accessing / setting the >types< child element(s).
explain
Returns a POD string describing how to call the methods of the service(s) described in the WSDL.
to_typemap
Creates a typemap for use with a generated type class library.
Options:
NAME DESCRIPTION
-------------------------------------------------------------------------
prefix Prefix to use for all classes
type_prefix Prefix to use for all (Complex/Simple)Type classes
element_prefix Prefix to use for all Element classes (with atomic types)
As some webservices tend to use globally unique type definitions, but locally unique elements with atomic types, type and element classes may be separated by specifying type_prefix and element_prefix instead of prefix.
The typemap is plain text which can be used as snipped for building a SOAP::WSDL class_resolver perl class.
Try something like this for creating typemap classes:
my $parser = XML::LibXML->new();
my $handler = SOAP::WSDL::SAX::WSDLHandler->new()
$parser->set_handler( $handler );
$parser->parse_url('file:///path/to/wsdl');
my $wsdl = $handler->get_data();
my $typemap = $wsdl->to_typemap();
print <<"EOT"
package MyTypemap;
my \%typemap = (
$typemap
);
sub get_class { return \$typemap{\$_[1] } };
1;
"EOT"
create_interface
Creates a typemap class, classes for all types and elements, and interface classes for every service.
See CODE GENERATOR below.
Options:
Name Description
----------------------------------------------------------------------------
prefix Prefix to use for types and elements. Should end with '::'.
element_prefix Prefix to use for element packages. Should end with '::'.
Must be specified if prefix is not given.
type_prefix Prefix to use for type packages. Should end with '::'.
Must be specified if prefix is not given.
typemap_prefix Prefix to use for type packages. Should end with '::'.
Mandatory.
custom_types A perl source code snippet defining custom types for the
class resolver (typemap).
Must look like this:
q{
'path/to/my/element' => 'My::Element',
'path/to/my/element/prop' => 'SOAP::WSDL::XSD::Typelib::Builtin::string',
'path/to/my/element/prop2' => 'SOAP::WSDL::XSD::Typelib::Builtin::string',
};
_expand
Expands a qualified name into a list consisting of namespace URI and localname by using the definition's xmlns table.
Used internally by SOAP::WSDL::* classes.
CODE GENERATOR
TODO: move somewhere else - maybe SOAP::WSDL::Client ?
SOAP::WSDL::Definitions features a code generation facility for generating perl classes (packages) from a WSDL definition.
The following classes are generated:
Typemaps
A typemap class is created for every service.
Typemaps are basically lookup classes. They allow the SOAP::WSDL::SAX::MessageHandler to find out which class a XML element in a SOAP message shoud be processed as.
Typemaps are passed to SOAP::WSDL::Client via the class_resolver method.
Interfaces
TODO: Implement Interface generation
Interface classes are just convenience shortcuts for accessing web service methods. They define a method for every web service method, dispatching the request to SOAP::WSDL::Client.
Type and Element classes
For every top-level <element>, <complexType> and <simpleType> definition in the WSDL's schema, a perl class is created.
Classes for <complexType> and <simpleType> definitions are prefixed by the
type_prefix
argument passed to create_interface, classes for <element> definitions are prefixed by theelement_prefix
passed to create_interface. If the specific prefixes are not specified, theprefix
argument is used instead.If your web service is part of a bigger framework which defines types globally, you probably do well always using the same
type_prefix
: This reduces the number of classes generated (provided types are re-used by more than one service).You probably should use different element prefixes, though - <element> definitions tend to be unique in the defining WSDL only, especially when using document/literal style/encoding.
If not, you probably want to specify just
prefix
(and use a different one for every web service).
LICENSE
Copyright 2004-2007 Martin Kutter.
This file is part of SOAP-WSDL. You may distribute/modify it under the same terms as perl itself
AUTHOR
Martin Kutter <martin.kutter fen-net.de>