Welcome to the "trac"-ing site of soap4r!
[soap4r] [httpclient] [openpgp4u] [pkcs1] [logger] [csv] [vtr]

Marshalling Struct of Ruby

  require 'soap/marshal'

  Foo1 = Struct.new( "Foo1", :m )
  Foo2 = Struct.new( :m )
  class Foo3
    attr_accessor :m
  end

  puts SOAP::Marshal.marshal( Foo1.new )
  puts SOAP::Marshal.marshal( Foo2.new )
  puts SOAP::Marshal.marshal( Foo3.new )

  p SOAP::Marshal.unmarshal( SOAP::Marshal.marshal( Foo1.new ))
    # => #<Struct::Foo1 m=nil>
  p SOAP::Marshal.unmarshal( SOAP::Marshal.marshal( Foo2.new ))
    # => #<Foo2 m=nil>
  p SOAP::Marshal.unmarshal( SOAP::Marshal.marshal( Foo3.new ))
    # => #<Foo3:0xa033fc0>

aFoo1

  <Struct..Foo1
    xsi:type="n2:Struct"
    env:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
    xmlns:n1="http://schemas.xmlsoap.org/soap/encoding/"
    xmlns:n2="http://www.ruby-lang.org/xmlns/ruby/type/1.6">
    <type xsi:type="xsd:string">Struct::Foo1</type>
    <member>
      <m xsi:nil="true"></m>
    </member>
  </Struct..Foo1>

aFoo2

  <Foo2
    xsi:type="n2:Struct"
    env:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
    xmlns:n1="http://schemas.xmlsoap.org/soap/encoding/"
    xmlns:n2="http://www.ruby-lang.org/xmlns/ruby/type/1.6">
    <type xsi:type="xsd:string">Foo2</type>
    <member>
      <m xsi:nil="true"></m>
    </member>
  </Foo2>

aFoo3

  <Foo3 xsi:type="n2:Foo3"
    env:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
    xmlns:n1="http://schemas.xmlsoap.org/soap/encoding/"
    xmlns:n2="http://www.ruby-lang.org/xmlns/ruby/type/custom">
  </Foo3>