Permalink
Browse files

rename service* to web_service*.

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@668 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
1 parent 5dcbe93 commit fdecb6843ba8c5b0f718225f343017e11fa7f711 @bitserf bitserf committed Feb 18, 2005
Showing with 279 additions and 294 deletions.
  1. +3 −0 actionservice/ChangeLog
  2. +14 −17 actionservice/README
  3. +9 −5 actionservice/TODO
  4. +10 −18 actionservice/examples/googlesearch/README
  5. +1 −3 actionservice/examples/googlesearch/delegated/google_search_service.rb
  6. +2 −2 actionservice/examples/googlesearch/delegated/search_controller.rb
  7. +50 −0 actionservice/examples/googlesearch/direct/google_search_api.rb
  8. +1 −52 actionservice/examples/googlesearch/direct/search_controller.rb
  9. +19 −13 actionservice/examples/metaWeblog/blog_controller.rb
  10. +27 −33 actionservice/lib/action_service/api/abstract.rb
  11. +16 −21 actionservice/lib/action_service/api/action_controller.rb
  12. +2 −2 actionservice/lib/action_service/base.rb
  13. +39 −39 actionservice/lib/action_service/container.rb
  14. +3 −3 actionservice/lib/action_service/invocation.rb
  15. +3 −3 actionservice/lib/action_service/protocol/abstract.rb
  16. +14 −14 actionservice/lib/action_service/protocol/soap.rb
  17. +1 −5 actionservice/lib/action_service/protocol/xmlrpc.rb
  18. +16 −14 actionservice/lib/action_service/router/action_controller.rb
  19. +3 −3 actionservice/lib/action_service/router/wsdl.rb
  20. +3 −4 actionservice/lib/action_service/struct.rb
  21. +1 −1 actionservice/lib/action_service/support/signature.rb
  22. +2 −2 actionservice/test/abstract_client.rb
  23. +4 −4 actionservice/test/base_test.rb
  24. +1 −1 actionservice/test/client_soap_test.rb
  25. +1 −1 actionservice/test/client_xmlrpc_test.rb
  26. +10 −10 actionservice/test/container_test.rb
  27. +2 −2 actionservice/test/invocation_test.rb
  28. +7 −7 actionservice/test/protocol_soap_test.rb
  29. +4 −4 actionservice/test/protocol_xmlrpc_test.rb
  30. +7 −7 actionservice/test/router_action_controller_test.rb
  31. +4 −4 actionservice/test/router_wsdl_test.rb
@@ -1,5 +1,8 @@
UNRELEASED
+ * lib/*,test/*,examples/*: prefix all generic "service"
+ type names with web_. update all using code as well as
+ the RDoc.
* lib/action_service/router/wsdl.rb: ensure that #wsdl is
defined in the final container class, or the new ActionPack
filtering will exclude it
View
@@ -60,7 +60,7 @@ ActionService::API::Base +inflect_names+ option.
==== API usage example
class PersonController < ActionController::Base
- service_api PersonAPI
+ web_service_api PersonAPI
def add
end
@@ -93,7 +93,7 @@ overridden.</em>
==== Direct dispatching example
class PersonController < ApplicationController
- service_api PersonAPI
+ web_service_api PersonAPI
def add
end
@@ -113,23 +113,23 @@ For this example, protocol requests for +Add+ and +Remove+ methods sent to
=== Delegated dispatching
-This mode can be turned on by setting the +service_dispatching_mode+ option
+This mode can be turned on by setting the +web_service_dispatching_mode+ option
in a controller.
-In this mode, the controller contains one or more service API objects (objects
-that implement an ActionService::API::Base definition). These API
+In this mode, the controller contains one or more web service objects (objects
+that implement an ActionService::API::Base definition). These web service
objects are each mapped onto one controller action only.
==== Delegated dispatching example
class ApiController < ApplicationController
- service_dispatching_mode :delegated
+ web_service_dispatching_mode :delegated
- service :person, PersonService.new
+ web_service :person, PersonService.new
end
class PersonService < ActionService::Base
- service_api PersonAPI
+ web_service_api PersonAPI
def add
end
@@ -146,10 +146,10 @@ objects are each mapped onto one controller action only.
For this example, all protocol requests for +PersonService+ are
sent to the <tt>/api/person</tt> action.
-The <tt>/api/person</tt> action is generated when the +service+
+The <tt>/api/person</tt> action is generated when the +web_service+
method is called. <em>This action must not be overridden.</em>
-Other controller actions (actions that aren't the target of a +service+ call)
+Other controller actions (actions that aren't the target of a +web_service+ call)
are ignored for ActionService purposes, and can do normal action tasks.
@@ -166,21 +166,18 @@ applications that both use Action Service. It may work with other servers, but
that is not its intended use, and interoperability can't be guaranteed, especially
not for .NET web services.
-Web services protocol specifications are complex, and Action Service can only
-be guaranteed to work with a subset.
+Web services protocol specifications are complex, and Action Service client
+support can only be guaranteed to work with a subset.
-If you have the need for clients for a complex service not running on Action
-Service, it is recommended that you use +wsdl2ruby+ and generate the client
-stub classes.
==== Factory created client example
class BlogManagerController < ApplicationController
- client_api :blogger, :xmlrpc, 'http://url/to/blog/api/RPC2', :handler_name => 'blogger'
+ web_client_api :blogger, :xmlrpc, 'http://url/to/blog/api/RPC2', :handler_name => 'blogger'
end
class SearchingController < ApplicationController
- client_api :google, :soap, 'http://url/to/blog/api/beta', :service_name => 'GoogleSearch'
+ web_client_api :google, :soap, 'http://url/to/blog/api/beta', :service_name => 'GoogleSearch'
end
See ActionService::API::ActionController::ClassMethods for more details.
View
@@ -1,3 +1,7 @@
+= 0.4.0 Tasks
+ - add ActiveRecord-like logging that includes timing information
+ - rename project to 'actionwebservice', Action Web Service
+
= Post-0.4.0 Tasks
- relax type-checking for XML-RPC, and perform casts between base types if there
are mismatches (i.e. String received when Integer expected, or vice-versa)
@@ -9,14 +13,14 @@
@request = controller.request
end
- service :mt {MTService.new(@request)}
- service :blogger {BloggerService.new(@request)}
- service :metaWeblog {MetaWeblogService.new(@request)}
+ web_service :mt {MTService.new(@request)}
+ web_service :blogger {BloggerService.new(@request)}
+ web_service :metaWeblog {MetaWeblogService.new(@request)}
end
class ApiController < ApplicationController
- service_dispatching_mode :delegated
- service :xmlrpc { BloggingServices.new(@request) }
+ web_service_dispatching_mode :delegated
+ web_service :xmlrpc { BloggingServices.new(@request) }
end
= Low priority tasks
@@ -1,6 +1,5 @@
= Google Service example
-
This example shows how one would implement an API like Google
Search that uses lots of structured types.
@@ -9,26 +8,19 @@ modes.
There is also an example for API definition file autoloading.
-= Running
-
- 1. Ensure you have the 'actionservice' Gem installed. You can generate it using
- this command:
-
- $ rake package
-
-
- 2. Edit config/environment.rb, and add the following line after the rest of the
- require_gem statements:
- require_gem 'actionservice'
+= Running the examples
+ 1. Add the files to an Action Web Service enabled Rails project.
- 3. "Direct" example:
+ "Direct" example:
* Copy direct/search_controller.rb to "app/controllers"
in a Rails project.
+ * Copy direct/google_search_api.rb to "app/apis"
+ in a Rails project
- "Delegated" example:
+ "Delegated" example:
* Copy delegated/search_controller.rb to "app/controllers"
in a Rails project.
@@ -44,7 +36,7 @@ There is also an example for API definition file autoloading.
in a Rails project.
- 4. Go to the WSDL url in a browser, and check that it looks correct.
+ 2. Go to the WSDL url in a browser, and check that it looks correct.
"Direct" and "Delegated" examples:
http://url_to_project/search/wsdl
@@ -60,7 +52,7 @@ There is also an example for API definition file autoloading.
explain extreme similarities :)
- 5. Test that it works with .NET (Mono in this example):
+ 3. Test that it works with .NET (Mono in this example):
$ wget WSDL_URL
$ mv wsdl GoogleSearch.wsdl
@@ -144,8 +136,8 @@ There is also an example for API definition file autoloading.
If you don't like this behaviour, you can do:
class MyController < ActionController::Base
- service_exception_reporting false
+ web_service_exception_reporting false
end
- 6. Crack open a beer. Publishing APIs for working with the same model as
+ 4. Crack open a beer. Publishing APIs for working with the same model as
your Rails web app should be easy from now on :)
@@ -1,5 +1,3 @@
-require 'action_service'
-
class DirectoryCategory < ActionService::Struct
member :fullViewableName, :string
member :specialEncoding, :string
@@ -52,7 +50,7 @@ class GoogleSearchAPI < ActionService::API::Base
end
class GoogleSearchService < ActionService::Base
- service_api GoogleSearchAPI
+ web_service_api GoogleSearchAPI
def doGetCachedPage(key, url)
"<html><body>i am a cached page</body></html>"
@@ -2,6 +2,6 @@
class SearchController < ApplicationController
wsdl_service_name 'GoogleSearch'
- service_dispatching_mode :delegated
- service :beta3, GoogleSearchService.new
+ web_service_dispatching_mode :delegated
+ web_service :beta3, GoogleSearchService.new
end
@@ -0,0 +1,50 @@
+class DirectoryCategory < ActionService::Struct
+ member :fullViewableName, :string
+ member :specialEncoding, :string
+end
+
+class ResultElement < ActionService::Struct
+ member :summary, :string
+ member :URL, :string
+ member :snippet, :string
+ member :title, :string
+ member :cachedSize, :string
+ member :relatedInformationPresent, :bool
+ member :hostName, :string
+ member :directoryCategory, DirectoryCategory
+ member :directoryTitle, :string
+end
+
+class GoogleSearchResult < ActionService::Struct
+ member :documentFiltering, :bool
+ member :searchComments, :string
+ member :estimatedTotalResultsCount, :int
+ member :estimateIsExact, :bool
+ member :resultElements, [ResultElement]
+ member :searchQuery, :string
+ member :startIndex, :int
+ member :endIndex, :int
+ member :searchTips, :string
+ member :directoryCategories, [DirectoryCategory]
+ member :searchTime, :float
+end
+
+class GoogleSearchAPI < ActionService::API::Base
+ inflect_names false
+
+ api_method :doGetCachedPage, :returns => [:string], :expects => [{:key=>:string}, {:url=>:string}]
+ api_method :doGetSpellingSuggestion, :returns => [:string], :expects => [{:key=>:string}, {:phrase=>:string}]
+
+ api_method :doGoogleSearch, :returns => [GoogleSearchResult], :expects => [
+ {:key=>:string},
+ {:q=>:string},
+ {:start=>:int},
+ {:maxResults=>:int},
+ {:filter=>:bool},
+ {:restrict=>:string},
+ {:safeSearch=>:bool},
+ {:lr=>:string},
+ {:ie=>:string},
+ {:oe=>:string}
+ ]
+end
@@ -1,56 +1,5 @@
-class DirectoryCategory < ActionService::Struct
- member :fullViewableName, :string
- member :specialEncoding, :string
-end
-
-class ResultElement < ActionService::Struct
- member :summary, :string
- member :URL, :string
- member :snippet, :string
- member :title, :string
- member :cachedSize, :string
- member :relatedInformationPresent, :bool
- member :hostName, :string
- member :directoryCategory, DirectoryCategory
- member :directoryTitle, :string
-end
-
-class GoogleSearchResult < ActionService::Struct
- member :documentFiltering, :bool
- member :searchComments, :string
- member :estimatedTotalResultsCount, :int
- member :estimateIsExact, :bool
- member :resultElements, [ResultElement]
- member :searchQuery, :string
- member :startIndex, :int
- member :endIndex, :int
- member :searchTips, :string
- member :directoryCategories, [DirectoryCategory]
- member :searchTime, :float
-end
-
-class GoogleSearchAPI < ActionService::API::Base
- inflect_names false
-
- api_method :doGetCachedPage, :returns => [:string], :expects => [{:key=>:string}, {:url=>:string}]
- api_method :doGetSpellingSuggestion, :returns => [:string], :expects => [{:key=>:string}, {:phrase=>:string}]
-
- api_method :doGoogleSearch, :returns => [GoogleSearchResult], :expects => [
- {:key=>:string},
- {:q=>:string},
- {:start=>:int},
- {:maxResults=>:int},
- {:filter=>:bool},
- {:restrict=>:string},
- {:safeSearch=>:bool},
- {:lr=>:string},
- {:ie=>:string},
- {:oe=>:string}
- ]
-end
-
class SearchController < ApplicationController
- service_api GoogleSearchAPI
+ web_service_api :google_search
wsdl_service_name 'GoogleSearch'
def doGetCachedPage
@@ -1,3 +1,6 @@
+# point your client at http://project_url/blog/api to test
+# this
+
# structures as defined by the metaWeblog/blogger
# specifications.
module Blog
@@ -73,7 +76,7 @@ class MetaWeblogAPI < ActionService::API::Base
end
class BlogController < ApplicationController
- service_api MetaWeblogAPI
+ web_service_api MetaWeblogAPI
def initialize
@postid = 0
@@ -99,23 +102,26 @@ def editPost
def getUsersBlogs
$stderr.puts "Returning user %s's blogs" % @params['username']
- blog = Blog::Blog.new
- blog.url = 'http://blog.xeraph.org'
- blog.blogid = 'sttm'
- blog.blogName = 'slave to the machine'
+ blog = Blog::Blog.new(
+ :url =>'http://blog.xeraph.org',
+ :blogid => 'sttm',
+ :blogName => 'slave to the machine'
+ )
[blog]
end
def getRecentPosts
$stderr.puts "Returning recent posts (%d requested)" % @params['numberOfPosts']
- post1 = Blog::Post.new
- post1.title = 'first post!'
- post1.link = 'http://blog.xeraph.org/testOne.html'
- post1.description = 'this is the first post'
- post2 = Blog::Post.new
- post2.title = 'second post!'
- post2.link = 'http://blog.xeraph.org/testTwo.html'
- post2.description = 'this is the second post'
+ post1 = Blog::Post.new(
+ :title => 'first post!',
+ :link => 'http://blog.xeraph.org/testOne.html',
+ :description => 'this is the first post'
+ )
+ post2 = Blog::Post.new(
+ :title => 'second post!',
+ :link => 'http://blog.xeraph.org/testTwo.html',
+ :description => 'this is the second post'
+ )
[post1, post2]
end
end
Oops, something went wrong. Retry.

0 comments on commit fdecb68

Please sign in to comment.