Expand Minimize

WsAddCustomHeader function

Adds the specified application-defined header to the message.

Syntax


HRESULT WINAPI  WsAddCustomHeader(
  _In_      WS_MESSAGE* message,
  _In_      const WS_ELEMENT_DESCRIPTION* headerDescription,
  _In_      WS_WRITE_OPTION writeOption,
  _In_      const void* &value,
  _In_      ULONG valueSize,
  _In_      ULONG headerAttributes,
  _In_opt_  WS_ERROR* error
);

Parameters

message [in]

The message to which to add the header.

The message can be in any state except WS_MESSAGE_STATE_EMPTY (see the WS_MESSAGE_STATE enumeration..

headerDescription [in]

The WS_ELEMENT_DESCRIPTION structure that describes the header.

writeOption [in]

Whether the header element is required, and how the value is allocated. For more information, see the WS_WRITE_OPTION enumeration.

value [in, ref]

The header value to serialize. For more information, see the WS_WRITE_OPTION enumeration.

valueSize [in]

The size of the value being serialized, in bytes.

headerAttributes [in]

The values of the SOAP attributes for the header.

error [in, optional]

Pointer to a WS_ERROR structure that receives additional error information if the function fails.

Return value

If the function succeeds, it returns NO_ERROR; otherwise, it returns an HRESULT error code.

Return codeDescription
WS_E_INVALID_FORMAT

There are multiple instances of the same type of header present in the message.

E_OUTOFMEMORY

Insufficient memory to complete the operation.

E_INVALIDARG

One or more of the parameters are incorrect.

Other Errors

This function may return other errors not listed above.

 

Remarks

The WsAddCustomHeader function is designed handle types of headers that are targeted at the final receiver. Headers targeted at another receiver are ignored.

If you are replacing a header, call the WsRemoveCustomHeader function to remove the existing instances of the header before calling WsAddCustomHeader.

Requirements

Minimum supported client

Windows 7 [desktop apps | Windows Store apps]

Minimum supported server

Windows Server 2008 R2 [desktop apps | Windows Store apps]

Header

WebServices.h

Library

WebServices.lib

DLL

WebServices.dll

 

 

Community Additions

ADD
Show:
© 2014 Microsoft