SoapHeaderRequestNode - cWebService

Returns SOAP header information passed to the web service as an XML object.

Type: Function

Return Data Type: Handle

Parameters: None

Return Value

Returns an object handle of the XML object representing the SOAP header, zero if no SOAP header exists.

Function SoapHeaderRequestNode Returns Handle

Call: Get SoapHeaderRequestNode to HandleVariable


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.
   <t:Transaction xmlns:t="some-URI">5</t:Transaction>

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
            Get NextNode of hoNode to hoNode
        // when done, destroy the XML object
        Send Destroy of hoXml
    If (sId<>"5") Begin
        Function_Return ""
    Move ("Hello, "+sName) to sReturn
    Function_Return sReturn

A SOAP response header can be returned from a web service method by using the AddSoapHeaderNode method.

See Also