История изменений
Исправление
Forum0888,
(текущая версия)
:
И что, получилось лучше, чем widl?
Посмотрите.
WebServicesWR.h
__declspec(dllexport) HRESULT WINAPI WsAddCustomHeader( // Adds the specified application-defined header to the message
_In_ WS_MESSAGE *message,
_In_ const WS_ELEMENT_DESCRIPTION *headerDescription,
_In_ WS_WRITE_OPTION writeOption,
_In_reads_bytes_(valueSize) const void *value,
_In_ ULONG valueSize,
_In_ ULONG headerAttributes,
_In_opt_ WS_ERROR *error
);
WebServicesWR.cpp
// --------------------------------------------------------
// --- Adds the specified application-defined header to the message.
//
HRESULT WINAPI CWebServices::WsAddCustomHeader(
_In_ WS_MESSAGE *message,
_In_ const WS_ELEMENT_DESCRIPTION *headerDescription,
_In_ WS_WRITE_OPTION writeOption,
_In_reads_bytes_(valueSize) 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 code Description
----------- -----------
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.
*/
BOOL bVp1 = TRUE;
ErrorClear // Clear error datas
HRESULT $VpHRESULT = ::WsAddCustomHeader(
message,
headerDescription,
writeOption,
value,
valueSize,
headerAttributes,
error
);
// ---
//
if ( $VpHRESULT == SOCKET_ERROR ) {
ErrorDataCodeWSA( TRUE, FALSE ) // Проверка на наличие ошибки
}
return TRUE; //
} // HRESULT WINAPI CWebServices::WsAddCustomHeader(
Исходная версия
Forum0888,
:
И что, получилось лучше, чем widl?
Посмотрите.
__declspec(dllexport) HRESULT WINAPI WsAddCustomHeader( // Adds the specified application-defined header to the message
_In_ WS_MESSAGE *message,
_In_ const WS_ELEMENT_DESCRIPTION *headerDescription,
_In_ WS_WRITE_OPTION writeOption,
_In_reads_bytes_(valueSize) const void *value,
_In_ ULONG valueSize,
_In_ ULONG headerAttributes,
_In_opt_ WS_ERROR *error
);
// --------------------------------------------------------
// --- Adds the specified application-defined header to the message.
//
HRESULT WINAPI CWebServices::WsAddCustomHeader(
_In_ WS_MESSAGE *message,
_In_ const WS_ELEMENT_DESCRIPTION *headerDescription,
_In_ WS_WRITE_OPTION writeOption,
_In_reads_bytes_(valueSize) 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 code Description
----------- -----------
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.
*/
BOOL bVp1 = TRUE;
ErrorClear // Clear error datas
HRESULT $VpHRESULT = ::WsAddCustomHeader(
message,
headerDescription,
writeOption,
value,
valueSize,
headerAttributes,
error
);
// ---
//
if ( $VpHRESULT == SOCKET_ERROR ) {
ErrorDataCodeWSA( TRUE, FALSE ) // Проверка на наличие ошибки
}
return TRUE; //
} // HRESULT WINAPI CWebServices::WsAddCustomHeader(
[\code]