Hi All,
Being a beginner in RoR WebServices, just trying to learn about the
different dispathing mechanisms. Direct dispatching is working fine, but
unable to get a perfect example for layered and delegated diapatching
techniques.
What I had tried is
------------------------------------------------------------------
Server Application
(hello_api.rb)
class HelloApi < ActionWebService::API::Base
api_method :getMsg,
:expects => [{:firstname => :string},{:lastname =>
:string}],
:returns => [:string]
end
----------------------
(second_ws_api.rb)
class SecondWsApi < ActionWebService::API::Base
api_method :get_message_from_second_ws,
:expects => [{:name => :string}],
:returns => [:date]
end
----------------------
(hello_controller.rb)
class HelloService < ActionWebService::Base
web_service_api HelloApi
def getMsg(first_name,last_name)
"Hiiiiiiiiiiii ....."+first_name+last_name
end
end
class SecondWsService < ActionWebService::Base
web_service_api SecondWsApi
def get_message_from_second_ws(name)
Date.today
end
end
class HelloController < ApplicationController
web_service_dispatching_mode :layered
web_service_scaffold :invoke
web_service :first_web_service, HelloService.new
web_service :second_web_service, SecondWsService.new
end
This is the application running on 3001 port. With the scaffold, the
wsdl and the invoke are working properly as guided in all the tutorials.
==========================================================
Client Application :
(web_service_client_controller.rb)
class WebServiceClientController < ApplicationController
require ''soap/wsdlDriver''
def get_name
first_ws_url = "http://localhost:3001/hello/wsdl"
first_soap_service = SOAP::WSDLDriverFactory.new
(first_ws_url).create_rpc_driver
puts "All the methods are :
#{first_soap_service.singleton_methods}"
message = first_soap_service.getMsg("First Name","Last
Name")
puts "SOAP : #{message}"
puts "SOAP : second method
:",first_soap_service.get_message_from_second_ws("My Name")
======> Result is
All the methods are : GetMsggetMsg
SOAP : Hiiiiiiiiiiii .....First NameLast Name, sedone method : #
and
undefined method `get_message_from_second_ws'' for
#<SOAP::RPC::Driver:0x4bab2c0>
----------------------------------------------------------------
Unable to get what exactly was the problem. Please help me in this.
Thanks and Regards
Sand.
--
Posted via http://www.ruby-forum.com/.