SoapHeaderRequestNode - cWebService
Returns SOAP header information passed to the web service as an XML object.
Type: Function
Return Data Type: Handle
Syntax
Function SoapHeaderRequestNode Returns Handle
Call Example
Get SoapHeaderRequestNode to HandleVariable
Description
The SoapHeaderRequestNode provides a low level mechanism for processing SOAP header information passed to the web service method. It is expected that a developer using this method understands SOAP headers and understands how to work with XML objects.
The object handle returned will be a handle to an XML document object (cXMLDomDocument) and represents the entire SOAP header XML node. The root node of this document will be the SOAP node and each child node should be an element node representing a header.
If a SOAP Header is not passed to the method, which is the norm, zero is returned.
It is the responsibility of the developer to destroy the XML object within the method that uses it.
<SOAP-ENV:Header
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<t:Transaction xmlns:t="some-URI">5</t:Transaction>
</SOAP-ENV:Header>
The above SOAP header could be processed as follows:
Function SayHello String sName Returns String
String sReturn
Handle hoXml hoRoot hoNode
String sId
Boolean bIsId
// get request headers
Get SoapHeaderRequestNode to hoXml
If (hoXml) Begin
Get DocumentElement of hoXML to hoRoot // should be SOAP <Header>
Get FirstChild of hoRoot to hoNode
// process all headers nodes
While (hoNode)
Get IsElementNS of hoNode "some-URI" "Transaction" to bIsId
If bIsId Begin
Get pstext of hoNode to sId
End
Get NextNode of hoNode to hoNode
Loop
// when done, destroy the XML object
Send Destroy of hoXml
End
If (sId<>"5") Begin
Function_Return ""
End
Move ("Hello, "+sName) to sReturn
Function_Return sReturn
End_Function
A SOAP response header can be returned from a web service method by using the AddSoapHeaderNode method.
See Also
Return Value
Returns an object handle of the XML object representing the SOAP header, zero if no SOAP header exists.