WsOpenServiceHost function (webservices.h)

Opens a Service Host for communication and starts the Listeners on all the endpoints. Client applications cannot connect to Service endpoints until WsOpenSerivceHost is called.

Syntax

HRESULT WsOpenServiceHost(
  [in]           WS_SERVICE_HOST        *serviceHost,
  [in, optional] const WS_ASYNC_CONTEXT *asyncContext,
  [in, optional] WS_ERROR               *error
);

Parameters

[in] serviceHost

A pointer to the Service Host object to open. The pointer must reference a valid WS_SERVICE_HOST object returned by WsCreateServiceHost and the referenced Service Host value may not be NULL.

[in, optional] asyncContext

A pointer to A WS_ASYNC_CONTEXT object that has information about how to invoke the function asynchronously. The value is set to NULL if invoking synchronously.

[in, optional] error

A pointer to a WS_ERROR object where additional information about the error should be stored if the function fails.

Return value

This function can return one of these values.

Return code Description
WS_S_ASYNC
The asynchronous operation is still pending.
WS_E_OPERATION_ABORTED
The service host was aborted before the open, or during the open.
WS_E_INVALID_OPERATION
The current state of the service proxy is not valid for this operation.
WS_E_ADDRESS_IN_USE
The address is already being used.
WS_E_ADDRESS_NOT_AVAILABLE
The address is not valid for this context.
WS_E_QUOTA_EXCEEDED
A quota was exceeded.
WS_E_OPERATION_ABORTED
The operation was aborted.
WS_E_OPERATION_TIMED_OUT
The operation did not complete within the time allotted.
E_OUTOFMEMORY
Ran out of memory.
E_INVALIDARG
One or more arguments are invalid.
Other Errors
This function may return other errors not listed above.

Remarks

Note that all the endpoints listeners have to successfully open before any channel is accepted by service host for communicating with the client.

Requirements

Requirement Value
Minimum supported client Windows 7 [desktop apps only]
Minimum supported server Windows Server 2008 R2 [desktop apps only]
Target Platform Windows
Header webservices.h
Library WebServices.lib
DLL WebServices.dll