Article ID: 259004 - Last Review: May 11, 2006 - Revision: 3.0 PRB: Cannot Use XML Interfaces RemotelyThis article was previously published under Q259004 SYMPTOMS
When you try to pass an XML interface between execution contexts, such as from a Microsoft Transaction Server component back to its caller or over the network through the use of DCOM, you receive the following error message when you call one of the interface's methods:
HRESULT = 0x800703E6: Invalid access to memory location.
CAUSE
Pointers to XML interfaces cannot cross execution contexts.
RESOLUTION
If you want to use XML across execution contexts, define a method on your wrappers that passes the raw XML data back to the caller (which you obtain through the use of IXMLDOMDocument::get_XML()). The caller can then call IXMLDOMDocument::loadXML(BSTR) on this string to restore the XML object locally.
STATUS
This behavior is by design.
MORE INFORMATION
Many developers want to create wrappers for MSXML and return pointers to interfaces such as IXMLDOMDocument directly from these wrappers. This works fine except when the interface must cross execution contexts. Execution contexts are crossed whenever the wrapper and its caller exist in two different types of COM apartments, in two different processes (such as when the component is used under Microsoft Transaction Server), or on two different computers. In order for an interface to cross execution contexts in COM, the interface must be marshalable. COM must be able to serialize the pointer to the interface into a stream of bits that can be transferred to the other execution context. Few people write marshaling code by hand. You can use Microsoft Interface Definition Language (MIDL) with the Microsoft IDL compiler to create marshaling code. MIDL creates the code for required proxy and stub marshaling objects when it compiles the IDL for a COM interface. IDL syntax allows interface declarations to define the attribute local, which prevents MIDL from compiling this marshaling code. This attribute is defined on all of the MSXML interfaces, as you can see by examining the MSXML.idl file that is included with Visual C++: REFERENCESFor additional information on COM threading models, click the article number below
to view the article in the Microsoft Knowledge Base:
150777
(http://support.microsoft.com/kb/150777/EN-US/
)
INFO: Descriptions and Workings of OLE Threading Models
For more information about developing Web-based solutions for Microsoft Internet Explorer, visit the following Microsoft Web sites:http://msdn.microsoft.com/ie/
(http://msdn.microsoft.com/ie/)
http://support.microsoft.com/iep (http://support.microsoft.com/iep) APPLIES TO
| Article Translations
|

Back to the top
