web services - Robust method for making a copy of a TRemotable object in Delphi 2007 -
Is Delphi a solid mechanism for copying traceable object (or lineage) in 2007?
I am creating a Delphi web service customer who receives different types of objects from a web service; Of course, all Tromtable descendants are in the client, I create a mail object, then I will copy all the attributes from the web service, which is permeable for my own object. It is done by TypInfo.GetPropList () and then a loop around TypInfo. GetPropValue () and TypInfo.SetPropValue () method calls though it works very well for the ordinary type - wires, ints, bool, etc., it does not work for complex types, such as date, time or sub-type type. And I think that if the web service ever uses a new complex type, then my copy code will also be broken.
It seems that the object is to be serialized in an XML document, then read it in a new object, but it seems like a lot of land to copy a series of many places.
More robust solutions, just type, seems to work fine for TXS ... Derivative types And sobobag type:
process copy (source, target: tromontable); Var Converter: IObjConverter; Node object: IXMLNode; Nodeparent: IXMLNode; Ndroot: IXMLNode; XML: IXML document; XMLStr: WideString; Start XML: = NewXML document; NodeRoot: = XML.AddChild ('root'); NodeParent: = NodeRoot.AddChild ('Guardian'); Converter: = TSOAPDomConv.Create (zero); NodeObject: = Source.ObjectToSOAP (nodroot, nodepart, converter, 'copy object', '', [oko do not suffixson], xmlstr); Target.SOAPToObject (nodroot, node object, converter); End;
Comments
Post a Comment