Skip to content

Commit

Permalink
Item9377:
Browse files Browse the repository at this point in the history
   * added =warn= parameter to suppress error messages
   * fixed perl rookie error for default values retrieved from a SOM object



git-svn-id: http://svn.foswiki.org/trunk/SoapPlugin@8281 0b4bb1d4-4e5a-0410-9cc4-b2b747904278
  • Loading branch information
MichaelDaum authored and MichaelDaum committed Jul 23, 2010
1 parent 84a1f7b commit 40d1d69
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 7 deletions.
3 changes: 3 additions & 0 deletions data/System/SoapPlugin.txt
Expand Up @@ -35,6 +35,7 @@ xpath expressions.
| verbatim="on/off" | this behaves like =raw="on"= basically but also pretty-prints the output to ease reading the xml and then puts it into a <verbatim> environment to format it as html |
| valueof="..." | xpath expression to filter the output |
| depth="int" | the depth to which an XML response object should be traversed while rendering it using =format=, =header=, =footer= and =separator= |
| warn="on/off" | if switched off all error warnings will be suppressed (defaults to on) |


Any additional parameter like for example =EMPLOYEEID= in
Expand Down Expand Up @@ -180,6 +181,8 @@ Every message created by !SoapPlugin adds a set of foswiki-specific headers whic
| Release: | %$RELEASE% |
| Version: | %$VERSION% |
| Change History: | <!-- versions below in reverse order -->&nbsp; |
| 14 Jun 2010: | added =warn= parameter to suppress error messages; \
fixed perl rookie error for default values retrieved from a SOM object |
| 10 May 2010: | added support for nested argument structures |
| 19 Mar 2010: | rewrite of serializer; implemented =$valueof()= etc; fixed UTF8 handling |
| 16 Mar 2010: | initial release |
Expand Down
2 changes: 1 addition & 1 deletion lib/Foswiki/Plugins/SoapPlugin.pm
Expand Up @@ -16,7 +16,7 @@ use strict;
use Foswiki::Func ();

our $VERSION = '$Rev$';
our $RELEASE = '0.6';
our $RELEASE = '1.0';
our $SHORTDESCRIPTION = 'SOAP for Foswiki';
our $NO_PREFS_IN_TOPIC = 1;
our $baseWeb;
Expand Down
2 changes: 1 addition & 1 deletion lib/Foswiki/Plugins/SoapPlugin/Client.pm
Expand Up @@ -122,7 +122,7 @@ sub parseParams {
$result ||= [];

foreach my $key (keys %$params) {
next if $key =~ /^(_.*|format|header|footer|separator|hidenull|method|verbatim|raw|valueof)$/;
next if $key =~ /^(_.*|format|header|footer|separator|hidenull|method|verbatim|raw|valueof|id|warn)$/;
my $val = $params->{$key};
my $attrs = new Foswiki::Attrs($val);
my $data;
Expand Down
17 changes: 12 additions & 5 deletions lib/Foswiki/Plugins/SoapPlugin/Core.pm
Expand Up @@ -130,6 +130,7 @@ sub normalizeParams {
$params->{raw} = ($params->{raw} eq 'on')?1:0;
$params->{verbatim} ||= 'off';
$params->{verbatim} = ($params->{verbatim} eq 'on')?1:0;
$params->{warn} ||= 'on';

return $params;
}
Expand Down Expand Up @@ -166,11 +167,18 @@ sub handleSOAPFORMAT {

writeDebug("called handleSOAPFORMAT()");
my $theId = $params->{_DEFAULT} || $params->{id};
return inlineError("Error: no id") unless $theId;

unless ($theId) {
return '' if $params->{warn} eq 'off';
return inlineError("Error: no id");
}

my $som = $knownSoms{$theId};

return inlineError("Error: unknown som id '$theId'") unless $som;
unless ($som) {
return '' if $params->{warn} eq 'off';
return inlineError("Error: unknown som id '$theId'");
}

return formatResult($som, $params);
}
Expand Down Expand Up @@ -212,9 +220,8 @@ sub stringify {
$line =~ s/\$valueof\((.*?)\)/fromUtf8($som->valueof($1||'')||'')/ge;

if ($line =~ /\$value\b/) {
my $value = $dataItem->value() ||'';

#print STDERR "value=$value ref=".ref($value)."\n";
my $value = $dataItem->value();
$value = '' unless defined $value;

my @values = ();
if (!ref($value) || ref($value) eq "SCALAR") {
Expand Down

0 comments on commit 40d1d69

Please sign in to comment.