# Transfer (own)ruby object over SOAP

**URL:** <https://www.ruby-forum.com/t/transfer-own-ruby-object-over-soap/113174>\
**Category:** Ruby\
**Created:** [August 28, 2007, 12:31pm UTC](https://www.ruby-forum.com/t/transfer-own-ruby-object-over-soap/113174 "2007-08-28T12:31:53Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Philipp](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/46a35a/32.png) [@Philipp](https://www.ruby-forum.com/u/Philipp)\
**Post date:** [August 28, 2007, 12:31pm UTC](https://www.ruby-forum.com/t/transfer-own-ruby-object-over-soap/113174/1 "2007-08-28T12:31:53Z")

</div>

Hello everyone,  
after 2 days searching the web for a solution i get stuck.

I have a rails APP with a SOAP interface and a simply ruby client  
e.g  
I have a object CAR that has a name and 4 DOORS

CAR \<-1:N-\> DOOR

//structure looks something like this  
class car {  
id  
name  
}

class door{  
id  
car\_id  
}

now i want to transfer a instance of the object car over soap to the  
client.  
SOAP only supports , primary class types like string, int, float and  
so on…right ?

now i was thinking about to do it with yaml or marshal, or xml i tried  
it the last 2 days but it dint work

# on the rails app i did

config\_dump = SOAP::Marshal.dump(cars)

# i did the transfer as a sting over soap

#on client side id did  
cars\_array = SOAP::Marshal.load(cars\_marshal)

but now i have a stange SOAP::Mapping::Object on the client side, is  
there a way to get a normal ruby object in this case CAR-object that i  
can do for example

car.doors.each{|door|  
puts door  
}

thanks ahead

regard  
Philipp  
ICQ #32815376

---

<div class="post-metadata">

**Author:** ![Philipp](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/46a35a/32.png) [@Philipp](https://www.ruby-forum.com/u/Philipp)\
**Post date:** [August 28, 2007, 3:19pm UTC](https://www.ruby-forum.com/t/transfer-own-ruby-object-over-soap/113174/2 "2007-08-28T15:19:18Z")

</div>

-----BEGIN PGP SIGNED MESSAGE-----  
Hash: SHA1

Hi,

If there’s no need for interoperability, you should use Marshal.

Philipp wrote:

> can do for example  
> Above should work. Please make sure you define user defined classes  
> (Car and Door) on the client side. Marshal requires it, too.

Regards,  
// NaHi

-----BEGIN PGP SIGNATURE-----  
Version: GnuPG v1.4.5 (Cygwin)

iQEVAwUBRtQgbB9L2jg5EEGlAQJNKAf+MWnLc7q/WRndeXU2CYtwZ2iR4qqzLV3g  
p2uymZlxkRPFIfS5om04dr01LMkw3urrlZgkzBqwKXocjMo+Er2IIaAmRMkRZtuU  
CYMi2NHoQG01sVOWVJwpm5/McC1Eb9tcJTGmck04WAjklMAqLPG1egehfO7/LFYF  
/P+uGXIB9fuU4VC/unzykhsFA4upwUO/bYi0EWr8NfgCSQNDy9qzCGUTKCRGmoXc  
sYIlE9XI1uvO+xFle5rHcjKEgHZdB3YW5Ue9tfvCMyfSy/F96Nc4L211A5b7AqKp  
WwfNL6eWMKzogxXwLGTYQwStHUKB/MkdHReh2SIgkyTzFY9+wzhVxQ==  
=6iVw  
-----END PGP SIGNATURE-----

---

<div class="post-metadata">

**Author:** ![Philipp](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/46a35a/32.png) [@Philipp](https://www.ruby-forum.com/u/Philipp)\
**Post date:** [August 28, 2007, 9:50pm UTC](https://www.ruby-forum.com/t/transfer-own-ruby-object-over-soap/113174/3 "2007-08-28T21:50:36Z")

</div>

Hello NaHi,  
thanks, for you answer.

I m using SOAP and WSDL right now,  
do u know it there is a trick, i dont want to define all the CLASSES  
on the client or in the WSDL API struct , is there a opotunity to  
(auto)generate a WSDL/CLASS config from the activerecords structur  
which is on the server ?

i think it would be also much easier to maintain afterwards if u do  
any extensions to on the server side…

thanks ahread

Philipp
