ATL Attributes: soap_header

Maps the specified member to a SOAP header

Syntax

[
    define_attribute = "soap_header",
    argument_list = {
        "value",
        "required",
        "in",
        "out"
    },
    argument_type ("value") = eANSIStringValue,
    argument_type ("required") = eBooleanValue,
    argument_type ("in") = eBooleanValue,
    argument_type ("out") = eBooleanValue,
    required_arguments = "value",
    default_value ("required") = "false",
    default_value ("in") = "true",
    default_value ("out") = "true",
    help_string = "Maps the specified member to a SOAP header",
    usage = eCoClassMethodUsage | eMethodUsage,
    group = eHPS,
    repeatable = true,
    shipping = true
];

Documentation Error

The product documentation says that this attribute is not repeatable. That the documentation is incorrect is easily demonstrated. Compile

#define     _WIN32_WINNT 0x0400
#define     _ATL_ATTRIBUTES
#include    <atlbase.h>
#include    <atlsoap.h>

[
    uuid ("00000000-0000-0000-0000-000000000000"),
    object
]
__interface ITest
{
    HRESULT Method (VOID);
};

[
    soap_handler ("")
]
class CTest : public ITest
{
    public:

    BSTR m_Name;
    bool m_Flag;

    [
        soap_method,
        soap_header ("m_Name"),
        soap_header ("m_Flag")
    ]
    HRESULT Method (VOID);
};

and see that the injected code accommodates both the data members that have been specified for use in SOAP headers.