[interchange-cvs] interchange - racke modified 2 files

interchange-core@icdevgroup.org interchange-core@icdevgroup.org
Sat Mar 8 20:07:00 2003


User:      racke
Date:      2003-03-09 01:06:14 GMT
Modified:  lib/Vend Config.pm SOAP.pm
Log:
SOAP_Action introduced, which is intended to used as a
way to provide webservices from an Interchange catalog

Revision  Changes    Path
2.101     +3 -2      interchange/lib/Vend/Config.pm


rev 2.101, prev_rev 2.100
Index: Config.pm
===================================================================
RCS file: /anon_cvs/repository/interchange/lib/Vend/Config.pm,v
retrieving revision 2.100
retrieving revision 2.101
diff -u -r2.100 -r2.101
--- Config.pm	12 Feb 2003 03:59:12 -0000	2.100
+++ Config.pm	9 Mar 2003 01:06:14 -0000	2.101
@@ -1,6 +1,6 @@
 # Vend::Config - Configure Interchange
 #
-# $Id: Config.pm,v 2.100 2003/02/12 03:59:12 mheins Exp $
+# $Id: Config.pm,v 2.101 2003/03/09 01:06:14 racke Exp $
 #
 # Copyright (C) 1996-2002 Red Hat, Inc. <interchange@redhat.com>
 # Copyright (C) 2003 ICDEVGROUP <interchange@icdevgroup.org>
@@ -46,7 +46,7 @@
 use Vend::Util;
 use Vend::Data;
 
-$VERSION = substr(q$Revision: 2.100 $, 10);
+$VERSION = substr(q$Revision: 2.101 $, 10);
 
 my %CDname;
 
@@ -483,6 +483,7 @@
 	['StaticTrack',		 undef,     	     ''],
 	['SOAP',			 'yesno',			 'No'],
 	['SOAP_Enable',		 'hash',			 ''],
+	['SOAP_Action',		 'action',			 ''],				   
 	['UserDB',			 'locale',	     	 ''], 
 	['UserDatabase',	 undef,		     	 ''],  #undocumented
 	['RobotLimit',		 'integer',		      0],



2.5       +21 -10    interchange/lib/Vend/SOAP.pm


rev 2.5, prev_rev 2.4
Index: SOAP.pm
===================================================================
RCS file: /anon_cvs/repository/interchange/lib/Vend/SOAP.pm,v
retrieving revision 2.4
retrieving revision 2.5
diff -u -r2.4 -r2.5
--- SOAP.pm	7 Mar 2003 13:49:50 -0000	2.4
+++ SOAP.pm	9 Mar 2003 01:06:14 -0000	2.5
@@ -1,6 +1,6 @@
 # Vend::SOAP - Handle SOAP connections for Interchange
 #
-# $Id: SOAP.pm,v 2.4 2003/03/07 13:49:50 racke Exp $
+# $Id: SOAP.pm,v 2.5 2003/03/09 01:06:14 racke Exp $
 #
 # Copyright (C) 1996-2002 Red Hat, Inc. <interchange@redhat.com>
 #
@@ -34,7 +34,7 @@
 use strict;
 
 use vars qw($VERSION @ISA $AUTOLOAD);
-$VERSION = substr(q$Revision: 2.4 $, 10);
+$VERSION = substr(q$Revision: 2.5 $, 10);
 @ISA = qw/SOAP::Server/;
 
 my %Allowed_tags;
@@ -278,6 +278,7 @@
     my $routine = $AUTOLOAD;
 #::logDebug("SOAP autoload called, routine=$routine, args=" . ::uneval(\@_));
 	my $class = shift;
+	my $sub;
 
 	if($Tmp::Autoloaded++ > 100) {
 		die "must be in endless loop, autoloaded $Tmp::Autoloaded times";
@@ -290,19 +291,29 @@
 #::logDebug("session " . ::full_dump() );
 
     $routine =~ s/.*:://;
-	die ::errmsg("Not allowed routine: %s", $routine) if ! $Allowed_tags{$routine};
+	if ($Vend::Cfg->{SOAP_Action}{$routine}) {
+		$sub = $Vend::Cfg->{SOAP_Action}{$routine};
+	} elsif (! $Allowed_tags{$routine}) {
+		die ::errmsg("Not allowed routine: %s", $routine);
+	}
 
 	my $result;
+	if (defined $sub) {
+		eval {
+			$result = $sub->(@_);
+		};
+	} else {
 #::logDebug("do_tag $routine, args=" . ::uneval(\@_));
-	eval {
-		if(ref($_[0])) {
+		eval {
+			if(ref($_[0])) {
 #::logDebug("resolving args");
-			@_ = Vend::Parse::resolve_args($routine, @_);
-		}
+				@_ = Vend::Parse::resolve_args($routine, @_);
+			}
 #::logDebug("do_tag $routine");
-		$result = Vend::Parse::do_tag($routine, @_);
-	};
-
+			$result = Vend::Parse::do_tag($routine, @_);
+		};
+	}
+	
 	my $error;
 	if($@) {
 		$error = errmsg("SOAP tag call failed: %s", $@);