-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On Tue, 12 Feb 2002 23:14, NAKAMURA, Hiroshi wrote:
> Hi,
>
> > From: Holden Glova [mailto:dsafari@xtra.co.nz]
> > Sent: Tuesday, February 12, 2002 6:05 PM
> >
> > Thank you very much :)
>
> welcome. :)
>
> > Can you ellaborate how and why I might use this
> > mysterious mappingRegistry?
>
> In SOAP world, a data model called "SOAP Data Model"
> is defined. It's a graph of typed object. Type is
> Struct, Array and simple types like string, integer,
> datetime, etc.
>
> SOAP spec defines SOAP Data Model <-> XML instance.
> No language mapping such as in CORBA world. So to
> define mapping between a language and SOAP Data Model
> is user's responsibility. Though SOAP4R defines
> default mapping for easy use, you can use custom
> mappingRegistry to define your mapping.
>
> For example, under SOAP4R's default mapping,
> Ruby's array is mapped to 'Array of anytype' in SOAP
> Data Model. Sending this array to remote endpoint,
> it will be mapped to Variant array under SOAP/COM mapping,
> or Vector under Java mapping.
>
> Don't you want to map some array to 'Array of int'
> exactly, do you? Then, at first, define your own Array;
>
> class IntArray < Array; end
>
> Create your custom mappingRegistry;
>
> map = SOAP::RPCUtils::MappingRegistry.new
> intArrayFactory =
> SOAP::RPCUtils::MappingRegistry::TypedArrayFactory
> map.set( IntArray, SOAP::SOAPArray, intArrayFactory,
> [ XSD::Namespace, XSD::IntLiteral ] )
>
> Then, pass use this map in marshalling/unmarshalling
> Ruby's object like;
>
> SOAP::Marshal.marshal( IntArray[ 1, 2, 3 ], map )
>
> Other than Marshal interface, SOAP::Driver and
> SOAP::Server has mappingRegistry attribute.
>
> Regards,
> // NaHi
Ah ha! In my reading over the weekend I did see these 'mappings' talked about
and I guessed that is what the mappingRegistry was for. Thank you for
confirming my suspicions and providing me a good example. I did try returning
myself a Person class that had it's own attributes and methods and it seems
to get back to the client just fine without specifying a MappingRegistry.
<snips a great example>
Thanks for this example.
- --
Signed,
Holden Glova
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see http://www.gnupg.org
iD8DBQE8aWqt+mF116Lw2cQRAizmAJoCngnZZbgKDqgsTgj0PMrV32cMggCfZ4Ea
W7d3ED8mCg+d0CCOprcpp6w=
=oUtx
-----END PGP SIGNATURE-----