Hi,
I have to access a webservice (write in Java) which take 3 arguments, 2
string and a complex type.
For the comple type i have defined a class child of
ActionWebService::Struct.
The problem is that when i invoke the method i get this error :
java.lang.NoSuchMethodException:
com.toto.xmlrpc.AccountTransaction.createHandler(java.util.ArrayList,
java.util.ArrayList, java.util.ArrayList)
Here is my code :
account_attributes_struct.rb
class AccountAttributesStruct < ActionWebService::Struct
member :LastName, :string
member :FirstName, :string
member :Country, :string
member :Language, :string
member :EMailAccount, :string
def initialize firstname, lastname,email
self.FirstName = firstname
self.LastName = lastname
self.EMailAccount = email
end
def inspect
return self.FirstName + " " + self.LastName + " " +
self.EMailAccount
end
end
account_api.rb
class AccountAPI < ActionWebService::API::Base
inflect_names false
api_method :exists, :expects => [:string], :returns => [:bool]
api_method ''login'', :expects => [:string], :returns
=> [:string]
api_method :create, :expects =>
[[:string],[:string],[{''attributes''
=> AccountAttributesStruct}]], :returns => [:string]
end
subscribe_controller.rb
client = ActionWebService::Client::XmlRpc.new(AccountAPI,
''http://test.toto.com./xmlrpc'', :handler_name =>
''account'')
attributes = AccountAttributesStruct.new(@person.firstname,
@person.lastname, @person.email)
client.create(login,''toto'',attributes.to_a)
If i don''t put .to_a after attributes i get the error "undefined
method
map for AccountAttributesStruct"
I hope someone could help me.
Thank you
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---