[evolvis-commits] r9023: Organizing the SOAP services files a bit ?==?UTF-8?Q?better↵
mirabilos at evolvis.org
mirabilos at evolvis.org
Thu Feb 24 16:58:01 CET 2011
Author: mirabilos
Date: 2011-02-24 16:58:01 +0100 (Thu, 24 Feb 2011)
New Revision: 9023
Modified:
trunk/gforge_base/evolvisforge-5.1/gforge/contrib/soap/ruby/soap_client.rb
trunk/gforge_base/evolvisforge-5.1/gforge/www/soap/SoapAPI.php
Log:
Organizing the SOAP services files a bit better
Modified: trunk/gforge_base/evolvisforge-5.1/gforge/contrib/soap/ruby/soap_client.rb
===================================================================
--- trunk/gforge_base/evolvisforge-5.1/gforge/contrib/soap/ruby/soap_client.rb 2011-02-24 15:57:59 UTC (rev 9022)
+++ trunk/gforge_base/evolvisforge-5.1/gforge/contrib/soap/ruby/soap_client.rb 2011-02-24 15:58:01 UTC (rev 9023)
@@ -1,20 +1,49 @@
#!/usr/bin/env ruby
require 'soap/driver'
-soapClient = SOAP::Driver.new( Devel::Logger.new(STDERR) , nil, 'GForgeAPI', 'http://shire/soap/SoapAPI.php' )
-soapClient = SOAP::Driver.new( nil , nil, 'GForgeAPI', 'http://shire/soap/SoapAPI.php' )
-#soapClient.setWireDumpDev(STDERR)
+class GForge
+ def create_session(host, userid, passwd)
+ soapClient = SOAP::Driver.new( Devel::Logger.new(STDERR) , nil, 'GForgeAPI', "http://#{host}/soap/SoapAPI.php" )
+ soapClient = SOAP::Driver.new( nil , nil, 'GForgeAPI', "http://#{host}/soap/SoapAPI.php" )
+ #soapClient.setWireDumpDev(STDERR)
+ soapClient.addMethod( 'login', 'userid', 'passwd')
+ soapClient.addMethod( 'logout', 'sessionkey')
+ soapClient.addMethod( 'bugList', 'sessionkey', 'project')
+ soapClient.addMethod( 'bugFetch', 'sessionkey', 'project', 'bugid')
+ soapClient.addMethod( 'bugAdd', 'sessionkey', 'project', 'summary', 'details')
+ soapClient.addMethod( 'bugUpdate', 'sessionkey', 'project', 'bugid', 'comment')
+ soapClient.addMethod( 'rfeAdd', 'sessionkey', 'project', 'summary', 'details')
+ soapClient.addMethod( 'rfeAddMessage', 'sessionkey', 'project', 'rfeid', 'body')
+ session=Session.new(soapClient, userid, passwd)
+ return session
+ end
+end
-# set up session control operations
-soapClient.addMethod( 'login', 'userid', 'passwd')
-soapClient.addMethod( 'logout', 'sessionkey')
+class Session
+ @key=@soapClient=nil
+ def initialize(soapClient, userid, passwd)
+ @key = soapClient.login(userid, passwd)
+ @soapClient = soapClient
+ end
+ def create_rfe(project, summary, details)
+ return @soapClient.rfeAdd(@key, project, summary, details)
+ end
+ def add_message_to_rfe(project, rfeID, body)
+ return @soapClient.rfeAddMessage(@key, project, rfeID,body)
+ end
+ def logout
+ @soapClient.logout(@key.to_s)
+ end
+end
-# set up bug operations
-soapClient.addMethod( 'bugList', 'sessionkey', 'project')
-soapClient.addMethod( 'bugFetch', 'sessionkey', 'project', 'bugid')
-soapClient.addMethod( 'bugAdd', 'sessionkey', 'project', 'summary', 'details')
-soapClient.addMethod( 'bugUpdate', 'sessionkey', 'project', 'bugid', 'comment')
+session = GForge.new.create_session("localhost", "tom", "tomtom")
+rfeID = session.create_rfe("othello", "A summary #{Time.now}", "A comment #{Time.now}")
+session.add_message_to_rfe("othello", rfeID, "A message");
+session.logout
+exit
+
+
func = ARGV.shift
if (func == "add")
@@ -28,6 +57,9 @@
elsif (func == "log")
soapClient.login("tom", "tomtom")
soapClient.logout(sessionKey)
+elsif (func == "hello")
+ soapClient.addMethod( 'hello', 'helloRequest')
+ puts soapClient.hello("word up")
elsif (func == "list")
sessionKey = soapClient.login("tom", "tomtom")
bugs= soapClient.bugList(sessionKey, "othello")
@@ -38,11 +70,5 @@
}
soapClient.logout(sessionKey)
else
- puts "Usage: soapClient.rb add|update|log|list"
+ puts "Usage: soapClient.rb add|update|log|list|hello"
end
-
-#soapClient.addMethod( 'hello', 'helloRequest')
-#puts soapClient.hello(ARGV[0])
-#exit
-
-exit
Modified: trunk/gforge_base/evolvisforge-5.1/gforge/www/soap/SoapAPI.php
===================================================================
--- trunk/gforge_base/evolvisforge-5.1/gforge/www/soap/SoapAPI.php 2011-02-24 15:57:59 UTC (rev 9022)
+++ trunk/gforge_base/evolvisforge-5.1/gforge/www/soap/SoapAPI.php 2011-02-24 15:58:01 UTC (rev 9023)
@@ -127,43 +127,8 @@
array('helloResponse'=>'xsd:string'),
$uri);
+// bugs
$server->register(
- 'getSiteStats',
- null,
- array('siteStats'=>'tns:ArrayOfSiteStatsDataPoint'),
- $uri);
-
-$server->register(
- 'group',
- array('func'=>'xsd:string','params'=>'tns:ArrayOfstring'),
- array('groupResponse'=>'tns:ArrayOfGroupObject'),
- $uri);
-
-$server->register(
- 'getNumberOfHostedProjects',
- null,
- array('hostedProjects'=>'xsd:string'),
- $uri);
-
-$server->register(
- 'getNumberOfActiveUsers',
- null,
- array('activeUsers'=>'xsd:string'),
- $uri);
-
-$server->register(
- 'getPublicProjectNames',
- null,
- array('projectNames'=>'tns:ArrayOfstring'),
- $uri);
-
-$server->register(
- 'user',
- array('func'=>'xsd:string','params'=>'tns:ArrayOfstring'),
- array('userResponse'=>'tns:ArrayOfstring'),
- $uri);
-
-$server->register(
'bugFetch',
array('sessionkey'=>'xsd:string','project'=>'xsd:string','bugid'=>'xsd:string'),
array('bugFetchResponse'=>'tns:Bug'),
@@ -186,7 +151,13 @@
array('sessionkey'=>'xsd:string','project'=>'xsd:string','bugid'=>'xsd:string','comment'=>'xsd:string'),
array('bugUpdateResponse'=>'xsd:string'),
$uri);
+// bugs
+// RFEs
+
+// RFEs
+
+// session/authentication
$server->register(
'login',
array('userid'=>'xsd:string','passwd'=>'xsd:string'),
@@ -198,8 +169,48 @@
null,
array('logoutResponse'=>'xsd:string'),
$uri);
+// session/authentication
+// statistics
+$server->register(
+ 'getSiteStats',
+ null,
+ array('siteStats'=>'tns:ArrayOfSiteStatsDataPoint'),
+ $uri);
+$server->register(
+ 'getNumberOfHostedProjects',
+ null,
+ array('hostedProjects'=>'xsd:string'),
+ $uri);
+
+$server->register(
+ 'getNumberOfActiveUsers',
+ null,
+ array('activeUsers'=>'xsd:string'),
+ $uri);
+// statistics
+
+// miscellaneous
+$server->register(
+ 'getPublicProjectNames',
+ null,
+ array('projectNames'=>'tns:ArrayOfstring'),
+ $uri);
+
+$server->register(
+ 'group',
+ array('func'=>'xsd:string','params'=>'tns:ArrayOfstring'),
+ array('groupResponse'=>'tns:ArrayOfGroupObject'),
+ $uri);
+
+$server->register(
+ 'user',
+ array('func'=>'xsd:string','params'=>'tns:ArrayOfstring'),
+ array('userResponse'=>'tns:ArrayOfstring'),
+ $uri);
+// miscellaneous
+
$wsdl_data = $server->wsdl->serialize();
if ($wsdl == "save") {
@@ -224,6 +235,7 @@
session_set();
}
+// session/authentication
/**
* login - Logs in a SOAP client
*
@@ -261,7 +273,9 @@
setcookie("session_ser", "", time() - 3600, "/", 0);
return new soapval('tns:soapVal','string',"OK");
}
+// session/authentication
+// statistics
/**
* getNumberOfHostedProjects - gets the number of active projects
*
@@ -296,17 +310,9 @@
$gforge = new GForge();
return new soapval('tns:soapVal', 'string', $gforge->getNumberOfActiveUsers());
}
+// statistics
/**
- * getPublicProjectNames - gets a list of public project names
- *
- */
-function getPublicProjectNames() {
- $gforge = new GForge();
- return new soapval('tns:ArrayOfString', 'ArrayOfstring', $gforge->getPublicProjectNames());
-}
-
-/**
* bugList - Lists all open bugs for a project
*
* @param string sessionkey The current session key
@@ -438,11 +444,23 @@
}
return new soapval('tns:soapVal','string',$artifact->getID());
}
+// bugs
+// miscellaneous
function hello($inputString){
return new soapval('tns:soapVal','string',$inputString.' echoed back to you');
}
+/**
+ * getPublicProjectNames - gets a list of public project names
+ *
+ */
+function getPublicProjectNames() {
+ $gforge = new GForge();
+ return new soapval('tns:ArrayOfString', 'ArrayOfstring', $gforge->getPublicProjectNames());
+}
+
+
function user($func, $params){
if ($func == "get") {
$where = "";
@@ -503,6 +521,7 @@
}
return new soap_fault ('1001', 'user', 'Unknown Function('.$func.') Must be \'get\'', 'No Detail');
}
+// miscellaneous
// 4. call the service method to initiate the transaction and send the response
More information about the evolvis-commits
mailing list