Skip to main content

Retrieving a Security Header Element

Retrieving a Security Header Element

In some cases, you might want to add custom processing for WS-Security header elements. To do this, use the SecurityIn property of the web service or client. If a service or client receives WS-Security header elements, this property is an instance of %SOAP.Security.HeaderOpens in a new tab that contains the header elements. For example:

 Set secheader=myservice.SecurityIn

Then use one of the following methods of that instance to retrieve a header element:

FindByEncryptedKeySHA1()
method FindByEncryptedKeySHA1(encryptedKeySHA1 As %Binary) as %SOAP.Security.Element

Returns the key from an <EncryptedKey> element that corresponds to the given EncryptedKeySHA1 argument. Or returns the empty string if there is no match.

FindElement()
method FindElement(type As %String, ByRef pos As %String) as %SOAP.Security.Element

Returns the first security element of the specified type after position pos. If there is no match, the method returns the empty string (and returns pos as 0).

For type, specify "Timestamp", "BinarySecurityToken", "UsernameToken", "Signature", or "EncryptedKey".

FindLastElement()
method FindLastElement(type As %String, ByRef pos As %String) as %SOAP.Security.Element

Returns the last security element of the specified type. If there is no match, the method returns the empty string (and returns pos as 0).

For information on type, see the entry for FindElement().

All these methods return either an instance of %SOAP.Security.ElementOpens in a new tab or an instance of one the following subclasses, depending upon the element type:

Element Type Subclass Used
"Timestamp" %SOAP.Security.TimestampOpens in a new tab
"BinarySecurityToken" %SOAP.Security.BinarySecurityTokenOpens in a new tab
"UsernameToken" %SOAP.Security.UsernameTokenOpens in a new tab
"Signature" %XML.Security.SignatureOpens in a new tab

For details, see the class reference.

FeedbackOpens in a new tab