XML Metadata Object Persistence

Jonathan Borden

Copyright (c) 1998-2000 ALL RIGHTS RESERVED

Contact: mailto:jborden@mediaone.net

The XMOP project has been released under GPL here

Abstract

XML Metadata Object Persistence (XMOP) allows interoperation between object technologies such as Java, Microsoft COM and CORBA. Java provides automatic serialization capabilites for simple classes yet for classes which contain string and array members, developers have to hand code the serialization methods. COM does not provide automatic serialization for simple nor complex objects. Developers code COM serialization/persistence through the IPersist derived interfaces. XMOP provides serialization and persistence capabilities to both Java and COM objects. Using XML based serialization has several benefits:

XML is coming under use to make Web remote procedure calls (XML-RPC). SOAP is a technique that is gaining industry support, especially from Microsoft, but whose technology is not Microsoft specific. The XMOP project releases GPL source to easily make client side SOAP calls through automatic generation of a javascript proxy from XMOP descriptions. XMOP also releases GPL source to make server side SOAP calls. Both the client and server sides employ XSLT.

Introduction

XML Metadata Object Persistence (XMOP) is unique in currently available object serialization mechanisms in that it is not directly tied to a particular object system. While at the same time providing an automatic serialization facility for COM components, use of XML provides the ability to interoperate with Java and is not tied to a particular Java VM.

XMOP employs the Simple Object Definition Language (SODL) and its DTD. Using introspection an object is serialized in the XMOP document format.

XMOP uses a class factory object which wraps the actual object. By examining the COM typelibrary or java reflection, the structure of the object is serialized using XMOP.

The XMOP document is a description of the interfaces, properties and methods of an object. This description can be transformed (XSLT) into a javascript proxy (for example), which encapsulates a call on the object. Such a call can be via SOAP, XML-RPC or RMI, either of which is transparent to the client.

Object Model

XMOPFactory

The XMOPFactory object implements the IXMOPFactory interface

interface IXMOPFactory {

Object CreateInstance(string ClassName);

string getTextDescription(string ClassName);

Object Attach(Object obj);

};

class XMOPFactory implements IXMOPFactory

{

};

The COM mapping:

interface IXMOPFactory : IDispatch {

[id(1)] HRESULT CreateInstance([in] BSTR ProgID, [out,retval] IUnknown** ppObject);

[id(2),propget] HRESULT TextDescription([in] BSTR ProgID,[out,retval] BSTR* pszDescription);

[id(3)] HRESULT Attach([in] IUnknown* pObject,[out,retval] IUnknown** ppWrappedObject);

};

coclass XMOPFactory{

[default] interface IXMOPFactory;

};

Here's the actual for real IDL file:

 

Discussion

The XMOP projects can be obtained at http://www.openhealth.org/xmop/ . This project includes a MSVC 5 project (the COM side assumes windows). The current project has been updated to use the IE5 DOM and the beta version of the Microsoft XSLT processor "MSXML2".

The java side employs the IBM4J DOM parser. IBM4J has provided source and is freely available. It should not be at all dificult to modify the source to employ other DOM java parsers. I have not yet started a SAX implementation.

The concept of object serialization is closely tied to the concept of marshaling whereby an object is transmitted across excecution space boundaries. Several projects have demonstrated XML serialization of Java classes.* The Koala project integrates with the Java class at the Serializable interface, providing a hook into the serialization stream itself. XMOP is a metadata driven serialization technique and employs the introspection facility.

References

Coins XML <-> JavaBeans integration

Koala XML serialization for Java

SOAP Simple Object Access Protocol, an XML-RPC protocol, more information can be found at DevelopMentor's SOAP site.