Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Getting a SOAP header parameter with SelectSingleNode
Message
 
À
19/01/2004 11:33:14
Information générale
Forum:
Visual FoxPro
Catégorie:
XML, XSD
Divers
Thread ID:
00867946
Message ID:
00868176
Vues:
20
This message has been marked as a message which has helped to the initial question of the thread.
Hi Michel,

Yes! The SetProperty method only exists in the DOMDocument class. Somewhere in your application you are instantiating a DOMDocument object right? If you can get a reference to this object from your method, it is just a matter of make this ajustment. Something like this:
PROTECTED FUNCTION IHeaderHandler_readHeader(toReader As MSSOAPLib30.ISoapReader,;
 toHeaderNode As MSXML2.IXMLDOMNode,toObject As Object) AS Boolean

  * ...
  
  * Get a reference to the DOMDocument object
  LOCAL loDOM as MSXML2.DOMDocucument.4.0
  loDOM = This.GetXMLDOM()
  loDOM.SetProperty('SelectionNamespaces',"xmlns:x='http://tempuri.org/MyHeader'")

  * ...

ENDFUNC
If you don't have access to the rest of the class, you can try to load the XML fragment of the SOAP header into a new temporary DOMDocument instance:
PROTECTED FUNCTION IHeaderHandler_readHeader(toReader As MSSOAPLib30.ISoapReader,;
 toHeaderNode As MSXML2.IXMLDOMNode,toObject As Object) AS Boolean

  * ...
  
  * Create a temporary DOMDocument Instance and load the XML header into it
  LOCAL loDOM as MSXML2.DOMDocucument.4.0
  loDOM = CREATEOBJECT("MSXML2.DOMDocument.4.0")
  loDOM.LoadXML( toHeaderNode.Xml )

  loDOM.SetProperty('SelectionNamespaces',"xmlns:x='http://tempuri.org/MyHeader'")
  loDOM.SelectSingleNode('/x:EnteteHere/x:FirstNode').Text

  * ...

  loDOM = null

ENDFUNC
Maybe it would be easier to use a DOMDocument version different than 4.0, which won't require that you use Namespace prefixes in your XPath expression when the elements are in the default Namespace:
PROTECTED FUNCTION IHeaderHandler_readHeader(toReader As MSSOAPLib30.ISoapReader,;
 toHeaderNode As MSXML2.IXMLDOMNode,toObject As Object) AS Boolean

  * ...
  
  * Create a temporary DOMDocument Instance and load the XML header into it
  LOCAL loDOM as MSXML2.DOMDocucument.3.0
  loDOM = CREATEOBJECT("MSXML2.DOMDocument.3.0")
  loDOM.LoadXML( toHeaderNode.Xml )

  loDOM.SelectSingleNode('/EnteteHere/FirstNode').Text

  * ...

  loDOM = null

ENDFUNC
HTH.
-----
Fabio Vazquez
http://www.fabiovazquez.com
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform