Archive of UserLand's first discussion group, started October 5, 1998.

RE: XML-RPC with Froniter::RPC

Author:Sean Brown
Posted:4/30/1999; 1:32:08 PM
Topic:RE: XML-RPC with Froniter::RPC
Msg #:5476 (In response to 5435)
Prev/Next:5475 / 5477

Ken MacLeod responded with a patch:

Frontier::RPC wasn't correctly decoding elements with no type subelement, which should default to string.

The following patch seems to solve the problem, give it a try and let me know:

-------- cut here -----

diff -uNr Frontier-RPC-0.05-orig/lib/Frontier/RPC2.pm Frontier-RPC-0.05/lib/Frontier/RPC2.pm --- Frontier-RPC-0.05-orig/lib/Frontier/RPC2.pm Tue Apr 13 14:43:46 1999 +++ Frontier-RPC-0.05/lib/Frontier/RPC2.pm Fri Apr 30 14:36:44 1999 @@ -306,6 +306,8 @@ push @{ $self->{'rpc_state'} }, 'want_param_name_or_value'; } elsif ($state eq 'want_param_name_or_value') { if ($tag eq 'value') { + $self->{'may_get_cdata'} = 1; + $self->{'rpc_text'} = ""; push @{ $self->{'rpc_state'} }, 'value'; } elsif ($tag eq 'name') { push @{ $self->{'rpc_state'} }, 'param_name'; @@ -317,8 +319,11 @@ } elsif ($state eq 'want_value') { Frontier::RPC2::die($self, "wanted \`value' tag, got \`$tag'\n") if ($tag ne 'value'); + $self->{'rpc_text'} = ""; + $self->{'may_get_cdata'} = 1; push @{ $self->{'rpc_state'} }, 'value'; } elsif ($state eq 'value') { + $self->{'may_get_cdata'} = 0; if ($tag eq 'array') { push @{ $self->{'rpc_container'} }, []; push @{ $self->{'rpc_state'} }, 'want_data'; @@ -339,6 +344,8 @@ } elsif ($state eq 'array') { Frontier::RPC2::die($self, "wanted \`value' tag, got \`$tag'\n") if ($tag ne 'value'); + $self->{'rpc_text'} = ""; + $self->{'may_get_cdata'} = 1; push @{ $self->{'rpc_state'} }, 'value'; } elsif ($state eq 'struct') { Frontier::RPC2::die($self, "wanted \`member' tag, got \`$tag'\n") @@ -385,6 +392,10 @@ } elsif ($state eq 'array') { $self->{'rpc_value'} = pop @{ $self->{'rpc_container'} }; } elsif ($state eq 'value') { + # the rpc_text is a string if no type tags were given + if ($self->{'may_get_cdata'}) { + $self->{'rpc_value'} = $self->{'rpc_text'}; + } my $container = $self->{'rpc_container'}[-1]; if (ref($container) eq 'ARRAY') { push @$container, $self->{'rpc_value'};






This page was archived on 6/13/2001; 4:49:40 PM.

© Copyright 1998-2001 UserLand Software, Inc.