UDDI

 view release on metacpan or  search on metacpan

UDDI/SOAP.pm  view on Meta::CPAN

    }
    else {
	$p->xpcroak("Unrecognized element $name ($ns)");
    }

    if ($class) {
	shift @$node;
	bless $node, $class;
    }

    push(@{$p->{stack}}, $node);
}

sub end_h
{
    my($p, $e) = @_;
    ns_leave($p);
    my $node = pop(@{$p->{stack}});

    # XXX might process $node here...

    push(@{$p->{stack}[-1]}, $node);
    return;
}

sub char_h
{
    my($p, $str) = @_;

    my $elem_type = ref($p->{stack}[-1]);

    if (exists $UDDI::elementContent{$elem_type}) {
	my $content = $UDDI::elementContent{$elem_type};
	unless ($content & UDDI::TEXT_CONTENT) {
	    $p->xpcroak("Text not allowed for $elem_type elements")
		if $str =~ /\S/;
	    return;
	}
    }

    if (!ref($p->{stack}[-1][-1])) {
	# Avoid subsequenct text segments
	$p->{stack}[-1][-1] .= $str;
    }
    else {
	push(@{$p->{stack}[-1]}, $str);
    }
}


package UDDI::SOAP::Envelope;

sub must_understand_headers
{
    my $self = shift;
    my @elem = @$self;
    shift(@elem); # attributes
    pop(@elem);   # body
    my @h;
    for (@elem) {
	die "Assert $_" unless ref($_) eq "UDDI::SOAP::Header";
	push(@h, $_->[1])
	    if $_->[1][0]{UDDI::SOAP::SOAP_ENV . "\0mustUnderstand"};
    }
    return @h;
}

sub body_content
{
    my $self = shift;
    my $body = $self->[-1];
    if (wantarray) {
	my @tmp = @$body;
	shift(@tmp);  # attributes
	return @tmp;
    }
    else {
	return $body->[1];
    }
}


package UDDI::SOAP::Fault;

sub code
{
    my $self = shift;
    my $code;
    for (@$self) {
	if (ref($_) eq "UDDI::SOAP::detail") {
	    my $d = $_->[-1];
	    if (ref($d) eq "UDDI::dispositionReport") {
		eval {
		    # hope for the best
		    $code = $d->result->errInfo->errCode;
		};
	    }
	    last;
	}
    }

    if (!$code) {
	for (@$self) {
	    if (ref($_) eq "UDDI::SOAP::faultcode") {
		$code = $_->[-1];
		last;
	    }
	}
    }

    $code ||= "SOAP_Fault";

    $code;
}

sub message
{
    my $self = shift;
    my $mess;
    for (@$self) {
	if (ref($_) eq "UDDI::SOAP::faultstring") {



( run in 1.480 second using v1.01-cache-2.11-cpan-39bf76dae61 )