WSDCreateDeviceProxy2 function (wsdclient.h)

Creates a device proxy that can support signed messages and returns a pointer to the IWSDDeviceProxy interface.

Syntax

HRESULT WSDCreateDeviceProxy2(
  [in]  LPCWSTR          pszDeviceId,
  [in]  LPCWSTR          pszLocalId,
  [in]  IWSDXMLContext   *pContext,
  [in]  WSD_CONFIG_PARAM *pConfigParams,
  [in]  DWORD            dwConfigParamCount,
  [out] IWSDDeviceProxy  **ppDeviceProxy
);

Parameters

[in] pszDeviceId

The logical or physical address of the device. A logical address is of the form urn:uuid:{guid}. A physical address is a URI prefixed by http or https. If this address is a URI prefixed by https, then the proxy will use the SSL/TLS protocol.

The device address may be prefixed with the @ character. When pszDeviceId begins with @, this function does not retrieve the device metadata when creating the device proxy.

[in] pszLocalId

The logical or physical address of the client, which is used to identify the proxy and to act as an event sink endpoint. A logical address is of the form urn:uuid:{guid}.

If the client uses a secure channel to receive events, then the address is a URI prefixed by https. This URI should specify port 5358, as this port is reserved for secure connections with WSDAPI. The port must be configured with an SSL server certificate before calling WSDCreateDeviceProxyAdvanced. For more information about port configuration, see HttpSetServiceConfiguration.

[in] pContext

An IWSDXMLContext object that defines custom message types or namespaces.

If NULL, a default context representing the built-in message types and namespaces is used.

[in] pConfigParams

An array of WSD_CONFIG_PARAM structures that contain the parameters for creating the object.

[in] dwConfigParamCount

The total number of structures passed in pConfigParams.

[out] ppDeviceProxy

Pointer to an IWSDDeviceProxy object that you use to represent a remote WSD device for client applications and middleware.

Return value

Possible return values include, but are not limited to, the following:

Return code Description
S_OK
Function completed successfully.
E_INVALIDARG
pszDeviceId is NULL, pszLocalId is NULL, the length in characters of pszDeviceId exceeds WSD_MAX_TEXT_LENGTH (8192), or the length in characters of pszLocalId exceeds WSD_MAX_TEXT_LENGTH (8192).
E_POINTER
ppDeviceProxy is NULL.
E_OUTOFMEMORY
Insufficient memory to complete the operation.

Remarks

The WSDCreateDeviceProxy2 function calls the IWSDDeviceProxy::Init method, which initializes an instance of an IWSDDeviceProxy object.

This function will also retrieve the device metadata, unless the pszDeviceId parameter begins with the @ character. To retrieve device metadata after the device proxy has been created, call IWSDDeviceProxy::BeginGetMetadata and IWSDDeviceProxy::EndGetMetadata on the returned IWSDDeviceProxy object.

For information about troubleshooting WSDCreateDeviceProxy2 function calls, see Troubleshooting WSDAPI Applications.

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 wsdclient.h (include Wsdapi.h)
Library Wsdapi.lib
DLL Wsdapi.dll