=head1 NAME

XML::Compile::WSDL11 - create SOAP messages defined by WSDL 1.1

=head1 INHERITANCE

 XML::Compile::WSDL11
   is a XML::Compile

=head1 SYNOPSIS

 # preparation
 my $wsdl    = XML::Compile::WSDL11->new($xml);
 $wsdl->addWSDL(...additional WSDL file...);
 $wsdl->importDefinitions(...more schemas...);

 my $call    = $wsdl->prepareClient('GetStockPrice');

 my $op      = $wsdl->operation('GetStockPrice');
 my $call    = $op->prepareClient;

 my $anwer   = $call->(%request);
 my ($anwer, $trace) = $call->(%request);

 my @op_defs = $wsdl->operations;

 # Install XML::Compile::SOAP::Daemon
 my $server  = XML::Compile::SOAP::HTTPDaemon->new;
 $server->actionsFromWSDL($wsdl);

=head1 DESCRIPTION

B<< This module is UNDER CONSTRUCTION.
Missing: pure HTTP GET/POST bindings, multipart-mime; XML-RPC >>

An WSDL file defines a set of schemas and how to use the defined
types using SOAP connections.  The parsing is based on the WSDL
schema.

The WSDL definition can get constructed from multiple XML trees, each
added with L<addWSDL()|XML::Compile::WSDL11/"Extension"> (wsdl), or L<importDefinitions()|XML::Compile::WSDL11/"Extension"> (schema).

=head1 METHODS

=head2 Constructors

XML::Compile::WSDL11-E<gt>B<new>(XML, OPTIONS)

=over 4

The XML is the WSDL file, which is anything accepted by
L<XML::Compile::dataToXML()|XML::Compile/"Read XML">.  All options are also passed
to create an internal L<XML::Compile::Schema|XML::Compile::Schema> object.  See
L<XML::Compile::Schema::new()|XML::Compile::Schema/"Constructors">

 Option        --Defined in     --Default
 schema_dirs     XML::Compile     undef
 wsdl_namespace                   undef

. schema_dirs => DIRECTORY|ARRAY-OF-DIRECTORIES

. wsdl_namespace => IRI

=over 4

Force to accept only WSDL descriptions which are in this namespace.  If
not specified, the name-space is enforced which is found in the first WSDL
document.

=back

=back

=head2 Accessors

$obj-E<gt>B<addSchemaDirs>(DIRECTORIES)

XML::Compile::WSDL11-E<gt>B<addSchemaDirs>(DIRECTORIES)

=over 4

See L<XML::Compile/"Accessors">

=back

$obj-E<gt>B<findSchemaFile>(FILENAME)

=over 4

See L<XML::Compile/"Accessors">

=back

$obj-E<gt>B<knownNamespace>(NAMESPACE|PAIRS)

XML::Compile::WSDL11-E<gt>B<knownNamespace>(NAMESPACE|PAIRS)

=over 4

See L<XML::Compile/"Accessors">

=back

$obj-E<gt>B<schemas>

=over 4

Returns the L<XML::Compile::Schema|XML::Compile::Schema> object which collects all type
information.

=back

$obj-E<gt>B<wsdlNamespace>([NAMESPACE])

=over 4

Returns (optionally after setting) the namespace used by the WSDL
specification.  This is the namespace in which the C<definition>
document root element is defined.

=back

=head2 Read XML

$obj-E<gt>B<dataToXML>(NODE|REF-XML-STRING|XML-STRING|FILENAME|KNOWN)

=over 4

See L<XML::Compile/"Read XML">

=back

=head2 Filters

$obj-E<gt>B<walkTree>(NODE, CODE)

=over 4

See L<XML::Compile/"Filters">

=back

=head2 Extension

$obj-E<gt>B<addWSDL>(XMLDATA)

=over 4

Some XMLDATA, accepted by L<XML::Compile::dataToXML()|XML::Compile/"Read XML"> is provided,
which should represent the top-level of a (partial) WSDL document.
The specification can be spread over multiple files, which each have a
C<definition> root element.

=back

$obj-E<gt>B<importDefinitions>(XMLDATA, OPTIONS)

=over 4

Add schema information to the WSDL interface knowledge.  This should
not be needed, because WSDL definitions must be self-contained.

=back

$obj-E<gt>B<namesFor>(CLASS)

=over 4

Returns the list of names available for a certain definition
CLASS in the WSDL.

=back

$obj-E<gt>B<operation>([NAME], OPTIONS)

=over 4

Collect all information for a certain operation.  Returned is an
L<XML::Compile::WSDL11::Operation|XML::Compile::WSDL11::Operation> object.

An operation is defined by a service name, a port, some bindings,
and an operation name, which can be specified explicitly or sometimes
left-out.

When not specified explicitly via OPTIONS, each of the CLASSes are only
permitted to have exactly one definition.  Otherwise, you must make a
choice explicitly.  There is a very good reason to be not too flexible
in this area: developers need to be aware when there are choices, where
some flexibility is required.

 Option   --Default
 operation  <required>
 port       <only when just one>
 service    <only when just one>

. operation => NAME

=over 4

Ignored when the parameter list starts with a NAME (which is an
alternative for this option).  Optional when there is only
one operation defined within the portType.

=back

. port => NAME

=over 4

Required when more than one port is defined.

=back

. service => QNAME

=over 4

Required when more than one service is defined.

=back

=back

$obj-E<gt>B<prepareClient>([NAME], OPTIONS)

=over 4

Creates temporarily an L<XML::Compile::WSDL11::Operation|XML::Compile::WSDL11::Operation> with L<operation()|XML::Compile::WSDL11/"Extension">,
and then calls C<prepareClient()> on that; an usual combination.

As OPTIONS are available the combination of all possibilities for
L<operation()|XML::Compile::WSDL11/"Extension"> and all of L<XML::Compile::WSDL11::Operation::prepareClient()|XML::Compile::WSDL11::Operation/"Handlers">.
For instance, C<transport_hook>.

=back

=head2 Inspection

All of the following methods are usually NOT meant for end-users. End-users
should stick to the L<operation()|XML::Compile::WSDL11/"Extension"> and L<prepareClient()|XML::Compile::WSDL11/"Extension"> methods.

$obj-E<gt>B<find>(CLASS, [QNAME])

=over 4

With a QNAME, the HASH which contains the parsed XML information
from the WSDL template for that CLASS-NAME combination is returned.
When the NAME is not found, an error is produced.

Without QNAME in SCALAR context, there may only be one such name
defined otherwise an error is produced.  In LIST context, all definitions
in CLASS are returned.

=back

$obj-E<gt>B<index>([CLASS, [QNAME]])

=over 4

With a CLASS and QNAME, it returns one WSDL definition HASH or undef.
Returns the index for the CLASS group of names as HASH.  When no CLASS is
specified, a HASH of HASHes is returned with the CLASSes on the top-level.

=back

$obj-E<gt>B<operations>(OPTIONS)

=over 4

Return a list with all operations defined in the WSDL.

 Option --Default
 produce  'HASHES'

. produce => 'OBJECTS'|'HASHES'

=over 4

By default, this function will return a list of HASHes, each representing
one defined operation.  When this option is set, those HASHes are
immediately used to create L<XML::Compile::WSDL11::Operation|XML::Compile::WSDL11::Operation> objects
per operation.

=back

=back

=head1 DETAILS

=head2 Comparison

=head2 Initializing SOAP operations via WSDL

When you have a WSDL file, then SOAP is simple.  If there is no such file
at hand, then it is still possible to use SOAP.  See the DETAILS chapter
in L<XML::Compile::SOAP|XML::Compile::SOAP>.

The WSDL file contains operations, which can be addressed by name.
In this WSDL file, you need to find the name of the port to be used.
In most cases, the WSDL has only one service, one port, one binding,
and one portType and those names can therefore be omitted.  If there is
a choice, then you are required to select one explicitly.

 use XML::Compile::WSDL11 ();

 # once in your program
 my $wsdl   = XML::Compile::WSDL11->new('def.wsdl');

 # once for each of the defined operations
 my $call   = $wsdl->prepareClient('GetStockPrice');

 # see XML::Compile::SOAP chapter DETAILS about call params
 my $answer = $call->(%request);

=head1 DIAGNOSTICS

Error: cannot find pre-installed name-space files

=over 4

Use C<$ENV{SCHEMA_LOCATION}> or L<new(schema_dirs)|XML::Compile/"Constructors"> to express location
of installed name-space files, which came with the L<XML::Compile|XML::Compile>
distribution package.

=back

Error: don't known how to interpret XML data

=over 4

=back

=head1 SEE ALSO

This module is part of XML-Compile-SOAP distribution version 0.57,
built on October 18, 2007. Website: F<http://perl.overmeer.net/xml-compile/>

=head1 LICENSE

Copyrights 2007 by Mark Overmeer. For other contributors see ChangeLog.

This program is free software; you can redistribute it and/or modify it
under the same terms as Perl itself.
See F<http://www.perl.com/perl/misc/Artistic.html>

