[Xml-compile] Feature proposal: XML::Compile::WSDL11::operations(port=>$portname)

Mark Overmeer mark at overmeer.net
Fri Mar 27 12:31:42 GMT 2009


* Georg Oechsler (goe at space.net) [090326 14:48]:
> To solve this, I made operation take an argument 'port' to return a list
> of all operations for the given port.

I plan this for the next release.  It extends what you propose.
Untested.  Sufficient for your needs?  ;-)

It would also be nice when you can ask an ::Operation to which service,
binding, port, portype it belongs.  I'll add that as well.

----- 8< -----
=method operations OPTIONS
Return a list with all operations defined in the WSDL.

=option  service NAME
=default service <undef>
Only return operations related to the NAMEd service, by default all services.

=option  port NAME
=default port <undef>
Return only operations related to the specified port NAME.
By default operations from all ports.

=option  binding NAME
=default binding <undef>
Only return operations which use the binding with the specified NAME.
By default, all bindings are accepted.
=cut

sub operations(@)
{   my ($self, %args) = @_;
    my @ops;
    $args{produce} and die "produce option removed in 0.81";

    foreach my $service ($self->findDef('service'))
    {
        next if $args{service} && $args{service} ne $service->{name};

        foreach my $port (@{$service->{wsdl_port} || []})
        {
            next if $args{port} && $args{port} ne $port->{name};

            my $bindtype = $port->{binding}
                or error __x"no binding defined in port '{name}'"
                      , name => $port->{name};
            my $binding  = $self->findDef(binding => $bindtype);

            next if $args{binding} && $args{binding} ne $binding->{name};

            my $type     = $binding->{type}
                or error __x"no type defined with binding `{name}'"
                    , name => $bindtype;

            foreach my $operation ( @{$binding->{wsdl_operation}||[]} )
            {   push @ops, $self->operation
                  ( service   => $service->{name}
                  , port      => $port->{name}
                  , binding   => $bindtype
                  , operation => $operation->{name}
                  , portType  => $type
                  );
            }
        }
    }

    @ops;
}

-- 
Regards,
               MarkOv

------------------------------------------------------------------------
       Mark Overmeer MSc                                MARKOV Solutions
       Mark at Overmeer.net                          solutions at overmeer.net
http://Mark.Overmeer.net                   http://solutions.overmeer.net




More information about the Xml-compile mailing list