Skip to content

ClearSoapHeaders - cClientWebService

Clears all SOAP request headers.

Type: Procedure

Syntax

Procedure ClearSoapHeaders

Call Example

Send ClearSoapHeaders

Description

ClearSoapHeaders is use to clear all SOAP request headers. This method, along with AddSoapHeaderNode, is used to create and manage SOAP request headers. This is a low level mechanism. It is expected that a developer using this method understands SOAP Headers and understands how to work with XML objects.

SOAP request headers in a web service client are maintained at the object level and not at the method level. When a header is added, it is added to all web service methods that are called within the object. Once a SOAP header is added, it will be added to all methods until the headers are all cleared using ClearSoapHeaders.

As a general rule, if you are using SOAP request headers in a web service object you should always clear the soap headers and add the new soap headers for each web service invocation.

Procedure CallTheMethod
    Handle hoXml hoRoot
    String sName sReply

    // always first clear any existing headers 
    Send ClearSoapHeaders of oWSTestService1

    Get Create U_cXmlDomDocument to hoXml
    Get CreateDocumentElementNS of hoXml "some-URI" "SomeHeader" to hoRoot
    Set psText of hoRoot to "SomeData"
    Send AddSoapHeaderNode of oWSTestService1 hoRoot
    // destroy the XML object
    Send Destroy of hoXml

    // invoke the service
    Get Value of oRequest to sName
    Get wsSayHello of oWSTestService1 sName to sReply
    Set Value of oResponse to sReply
End_Procedure

See Also

AddSoapHeaderNode | SoapHeaderRequestNode | SoapHeaderResponseNode