HRESULT Initialize([in] BSTR xmlType, [in] BSTR xmlTypeNamespace, [in] VARIANT comType);
Once the serializerFactory has created the serializer, it calls this passing the type information it used to select this [de]serializer. The [de]serializer can later use this information as needed, e.g. to write out an xsi:type='ns:type' attribute during serialization.
Raise an error here if either the Xml Type or COM type is unexpected. This will stop the serialization process, and bubble the error to the calling code.
Visual Basic Class File
Private Const NS = "http://auth.example.org/2001/01/"
Implements ISoapSerializer
Implements ITypesInit
Private m_type As String
Private m_ns As String
Private Sub ITypesInit_Initialize(ByVal XmlType As String, ByVal XmlTypeNamespace As String, ByVal ComType As Variant)
m_type = XmlType
m_ns = XmlTypeNamespace
End Sub
Private Sub ISoapSerializer_Serialize(V As Variant, _
ByVal ctx As PocketSOAP.ISerializerContext, _
ByVal dest As PocketSOAP.ISerializerOutput)
Dim sf As CoSerializerFactory
Set sf = ctx.SerializerFactory
dest.QNameAttribute "type", sf.XsiForPrimaryNS, m_type, m_ns
dest.SerializeValue V.Key, "key", NS
dest.SerializeValue V.Type, "type", NS
End Sub
Copyright © Simon Fell, 2000-2004. All rights reserved.