Skip to content

Latest commit

 

History

History
117 lines (85 loc) · 4.29 KB

nc-webservices-ws_service_message_receive_callback.md

File metadata and controls

117 lines (85 loc) · 4.29 KB
UID title description helpviewer_keywords old-location tech.root ms.assetid ms.date ms.keywords req.header req.include-header req.target-type req.target-min-winverclnt req.target-min-winversvr req.kmdf-ver req.umdf-ver req.ddi-compliance req.unicode-ansi req.idl req.max-support req.namespace req.assembly req.type-library req.lib req.dll req.irql targetos req.typenames req.redist ms.custom f1_keywords dev_langs topic_type api_type api_location api_name
NC:webservices.WS_SERVICE_MESSAGE_RECEIVE_CALLBACK
WS_SERVICE_MESSAGE_RECEIVE_CALLBACK (webservices.h)
Invoked when a WS_MESSAGE is received on an endpoint configured with a WS_SERVICE_CONTRACT which has defaultMessageHandlerCallback set.
WS_SERVICE_MESSAGE_RECEIVE_CALLBACK
WS_SERVICE_MESSAGE_RECEIVE_CALLBACK callback
WS_SERVICE_MESSAGE_RECEIVE_CALLBACK callback function [Web Services for Windows]
webservices/WS_SERVICE_MESSAGE_RECEIVE_CALLBACK
wsw.ws_service_message_receive_callback
wsw\ws_service_message_receive_callback.htm
wsw
2fcd8905-7002-41b8-b947-14d53c889c21
12/05/2018
WS_SERVICE_MESSAGE_RECEIVE_CALLBACK, WS_SERVICE_MESSAGE_RECEIVE_CALLBACK callback, WS_SERVICE_MESSAGE_RECEIVE_CALLBACK callback function [Web Services for Windows], webservices/WS_SERVICE_MESSAGE_RECEIVE_CALLBACK, wsw.ws_service_message_receive_callback
webservices.h
Windows
Windows 7 [desktop apps \| UWP apps]
Windows Server 2008 R2 [desktop apps \| UWP apps]
Windows
19H1
WS_SERVICE_MESSAGE_RECEIVE_CALLBACK
webservices/WS_SERVICE_MESSAGE_RECEIVE_CALLBACK
c++
APIRef
kbSyntax
UserDefined
WebServices.h
WS_SERVICE_MESSAGE_RECEIVE_CALLBACK

WS_SERVICE_MESSAGE_RECEIVE_CALLBACK callback function

-description

Invoked when a WS_MESSAGE is received on an endpoint configured with a WS_SERVICE_CONTRACT which has defaultMessageHandlerCallback set.

The incoming WS_MESSAGE, the serviceProxy along with other parameters is made available to the callback through WS_OPERATION_CONTEXT.

-parameters

-param context [in]

The context within which this callback is being invoked.

-param asyncContext [in, optional]

Specifies whether the callback can run asynchronously.

-param error [in, optional]

Specifies where additional error information should be stored if the function fails.

-returns

This callback function does not return a value.

-remarks

When defined, callback would disallow all concurrency on a session based channel. If concurrency on a session based channel is desirable an application should not define WS_SERVICE_MESSAGE_RECEIVE_CALLBACK on the WS_SERVICE_CONTRACT.

At the time of the invocation of the callback, service model has performed WsReadMessageStart on the receiving WS_MESSAGE. It is the responsibility of the application implementing WS_SERVICE_MESSAGE_RECEIVE_CALLBACK to process the body and perform WsReadMessageEnd operation.

If the callback fails, the underlying channel is aborted.

See also, UnTypedServiceExample

Examples

Defining a WS_SERVICE_MESSAGE_RECEIVE_CALLBACK

// Method contract for the service
static WS_SERVICE_CONTRACT calculatorContract = 
{
    NULL, 
    NULL, 
    DefaultMessageHandlerCallback, // WS_SERVICE_MESSAGE_RECEIVE_CALLBACK
    NULL
};

Accessing the incoming WS_MESSAGE property

HRESULT CALLBACK MessageRecieved(const WS_OPERATION_CONTEXT* context, const WS_ASYNC_CONTEXT* asyncContext, WS_ERROR* error)
{
    :
    hr = WsGetOperationContextProperty(context, WS_OPERATION_CONTEXT_PROPERTY_INPUT_MESSAGE, &requestMessage, sizeof(requestMessage), NULL, error);
    :
}