SOAP::WSDL::Definitions - model a WSDL >definitions< element
Accessors/Mutators for accessing / setting the >service< child element(s).
Returns the service matching the namespace/localname pair passed as arguments.
my $service = $wsdl->find_service($namespace, $localname);
Accessors/Mutators for accessing / setting the >binding< child element(s).
Returns the binding matching the namespace/localname pair passed as arguments.
my $binding = $wsdl->find_binding($namespace, $localname);
Accessors/Mutators for accessing / setting the >portType< child element(s).
Returns the portType matching the namespace/localname pair passed as arguments.
my $portType = $wsdl->find_portType($namespace, $localname);
Accessors/Mutators for accessing / setting the >message< child element(s).
Returns the message matching the namespace/localname pair passed as arguments.
my $message = $wsdl->find_message($namespace, $localname);
Accessors/Mutators for accessing / setting the >types< child element(s).
Returns a POD string describing how to call the methods of the service(s) described in the WSDL.
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"
Creates a typemap class, classes for all types and elements, and interface classes for every service.
See CODE GENERATOR below.
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', };
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.
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 the element_prefix passed to create_interface. If the specific prefixes are not specified, the prefix argument is used instead.
type_prefix
element_prefix
prefix
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).
Copyright 2004-2007 Martin Kutter.
This file is part of SOAP-WSDL. You may distribute/modify it under the same terms as perl itself
Martin Kutter <martin.kutter fen-net.de>
To install SOAP::WSDL, copy and paste the appropriate command in to your terminal.
cpanm
cpanm SOAP::WSDL
CPAN shell
perl -MCPAN -e shell install SOAP::WSDL
For more information on module installation, please visit the detailed CPAN module installation guide.