[%  RETURN IF NOT item;
    type = definitions.find_portType( binding.expand( binding.get_type ) );
    port_op = type.find_operation( type.get_targetNamespace, operation.get_name );
    message = definitions.find_message( port_op.first_input.expand( port_op.first_input.get_message ) );
    part_from = message.get_part;
    PERL %]
    my $item = $stash->{ item };
    my $def = $stash->{ definitions };
    my $part_from = $stash->{ message }->get_part();

    my @body_part_from = split m{\s}, $item->get_parts;

    my @parts;
    if (@body_part_from) {
        @parts = map {
            my $part = $_;
            (grep {
                # my ($ns, $lname) = $def->expand( $_ );
                ($_ eq $part->get_name)
                } @body_part_from
            )
            ? do {
                my $name;
                ($name = $part->get_element)
                    ? do {
                        my $element = $def->first_types->find_element($part->expand($name));
                        my $resolver = $context->plugin('XSD');
                        $resolver->create_xsd_name($element);

                    }
                    : ($name = $part->get_type)
                        ? do {
                            my $element = $def->first_types->find_type($part->expand($name));
                            my $resolver = $context->plugin('XSD');
                            $resolver->create_xsd_name($element);
                        }
                    : die "input must have either type or element"
                }
            : ()
        } @{ $part_from };
    }
    else {
        @parts = map {
            my $part = $_;
            my $name;
            ($name = $part->get_element)
               ? do {
                    my $element = $def->first_types->find_element($part->expand($name));
                    my $resolver = $context->plugin('XSD');
                    $resolver->create_xsd_name($element);
               }
               : ($name = $part->get_type)
                    ? do {
                            my $element = $def->first_types->find_type($part->expand($name));
                            my $resolver = $context->plugin('XSD');
                            $resolver->create_xsd_name($element);
                    }
                    : die "input must have either type or element";
        } @{ $part_from };
    }

    warn "Multiple parts detected in message " . $stash->{ message }->get_name() . ".\n",
        "WS-I BP demands 0 to 1 parts in message body\n"
        if (@parts > 1);

    $stash->{ parts } = \@parts;

[% END %]
[% IF item.get_use != 'literal';
    THROW NOT_SUPPORTED "Body: SOAP::WSDL supports literal encoding only - ${ item.get_use } found";
END %]
           'use'            => '[% item.get_use %]',
            namespace       => '[% item.get_namespace %]',
            encodingStyle   => '[% item.get_encodingStyle %]',
            parts           =>  [qw( [% parts.join(' ') %] )],