# Struct with xml rpc

**URL:** <https://www.ruby-forum.com/t/struct-with-xml-rpc/111169>\
**Category:** Rails\
**Created:** [August 3, 2007, 1:43pm UTC](https://www.ruby-forum.com/t/struct-with-xml-rpc/111169 "2007-08-03T13:43:08Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![lephasme](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/9dc877/32.png) [@lephasme](https://www.ruby-forum.com/u/lephasme)\
**Post date:** [August 3, 2007, 1:43pm UTC](https://www.ruby-forum.com/t/struct-with-xml-rpc/111169/1 "2007-08-03T13:43:08Z")

</div>

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](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
