WsCreateServiceProxyFromTemplate function (webservices.h)

Helper routine for creating a service proxy from policy templates.

Syntax

HRESULT WsCreateServiceProxyFromTemplate(
  [in]           WS_CHANNEL_TYPE          channelType,
                 const WS_PROXY_PROPERTY  *properties,
  [in]           const ULONG              propertyCount,
  [in]           WS_BINDING_TEMPLATE_TYPE templateType,
                 void                     *templateValue,
  [in]           ULONG                    templateSize,
  [in]           const void               *templateDescription,
  [in]           ULONG                    templateDescriptionSize,
                 WS_SERVICE_PROXY         **serviceProxy,
  [in, optional] WS_ERROR                 *error
);

Parameters

[in] channelType

A WS_CHANNEL_TYPE enumeration value representing the channel type for the service proxy.

properties

An array of WS_PROXY_PROPERTY structures containing optional properties for the service proxy.

The value of this parameter may be NULL, in which case, the propertyCount parameter must be 0 (zero).

[in] propertyCount

The number of properties in the properties array.

[in] templateType

A WS_BINDING_TEMPLATE_TYPE enumeration value representing the type of templates used to create the service proxy.

Please see the Remarks for more information.

templateValue

The optional template structure to be created and filled in by an application. This template structure must be consistent with the input template type (in the templateType). When templateValue parameter is NULL, it is equivalent to the corresponding template structure initialized to zero.

Please see the Remarks for more information.

[in] templateSize

The size, in bytes, of the template structure (in the templateValue parameter).

[in] templateDescription

The description of templateValue. This must match templateType.

Please see the Remarks for more information.

[in] templateDescriptionSize

The size of the template description.

serviceProxy

On success, a pointer that receives the address of the WS_SERVICE_PROXY structure representing the new service proxy.

When you no longer need this structure, you must free it by calling WsFreeServiceProxy.

[in, optional] error

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.

Remarks

WsCreateServiceProxyFromTemplate creates the WS_SERVICE_PROXY structure from input policy templates and additional user input.

The following table shows the mapping between templateType values and the corresponding data types to be used in templateValue and templateDescription.

templateType templateValue templateDescription
WS_HTTP_BINDING_TEMPLATE_TYPE WS_HTTP_BINDING_TEMPLATE WS_HTTP_POLICY_DESCRIPTION
WS_HTTP_SSL_BINDING_TEMPLATE_TYPE WS_HTTP_SSL_BINDING_TEMPLATE WS_HTTP_SSL_POLICY_DESCRIPTION
WS_HTTP_HEADER_AUTH_BINDING_TEMPLATE_TYPE WS_HTTP_HEADER_AUTH_BINDING_TEMPLATE WS_HTTP_HEADER_AUTH_POLICY_DESCRIPTION
WS_HTTP_SSL_HEADER_AUTH_BINDING_TEMPLATE_TYPE WS_HTTP_SSL_HEADER_AUTH_BINDING_TEMPLATE WS_HTTP_SSL_HEADER_AUTH_POLICY_DESCRIPTION
WS_HTTP_SSL_USERNAME_BINDING_TEMPLATE_TYPE WS_HTTP_SSL_USERNAME_BINDING_TEMPLATE WS_HTTP_SSL_USERNAME_POLICY_DESCRIPTION
WS_HTTP_SSL_KERBEROS_APREQ_BINDING_TEMPLATE_TYPE WS_HTTP_SSL_KERBEROS_APREQ_BINDING_TEMPLATE WS_HTTP_SSL_KERBEROS_APREQ_POLICY_DESCRIPTION
WS_TCP_BINDING_TEMPLATE_TYPE WS_TCP_BINDING_TEMPLATE WS_TCP_POLICY_DESCRIPTION
WS_TCP_SSPI_BINDING_TEMPLATE_TYPE WS_TCP_SSPI_BINDING_TEMPLATE WS_TCP_SSPI_POLICY_DESCRIPTION
WS_TCP_SSPI_USERNAME_BINDING_TEMPLATE_TYPE WS_TCP_SSPI_USERNAME_BINDING_TEMPLATE WS_TCP_SSPI_USERNAME_POLICY_DESCRIPTION
WS_TCP_SSPI_KERBEROS_APREQ_BINDING_TEMPLATE_TYPE WS_TCP_SSPI_KERBEROS_APREQ_BINDING_TEMPLATE WS_TCP_SSPI_KERBEROS_APREQ_POLICY_DESCRIPTION
WS_HTTP_SSL_USERNAME_SECURITY_CONTEXT_BINDING_TEMPLATE_TYPE WS_HTTP_SSL_USERNAME_SECURITY_CONTEXT_BINDING_TEMPLATE WS_HTTP_SSL_USERNAME_SECURITY_CONTEXT_POLICY_DESCRIPTION
WS_HTTP_SSL_KERBEROS_APREQ_SECURITY_CONTEXT_BINDING_TEMPLATE_TYPE WS_HTTP_SSL_KERBEROS_APREQ_SECURITY_CONTEXT_BINDING_TEMPLATE WS_HTTP_SSL_KERBEROS_APREQ_SECURITY_CONTEXT_POLICY_DESCRIPTION
WS_TCP_SSPI_USERNAME_SECURITY_CONTEXT_BINDING_TEMPLATE_TYPE WS_TCP_SSPI_USERNAME_SECURITY_CONTEXT_BINDING_TEMPLATE WS_TCP_SSPI_USERNAME_SECURITY_CONTEXT_POLICY_DESCRIPTION
WS_TCP_SSPI_KERBEROS_APREQ_SECURITY_CONTEXT_BINDING_TEMPLATE_TYPE WS_TCP_SSPI_KERBEROS_APREQ_SECURITY_CONTEXT_BINDING_TEMPLATE WS_TCP_SSPI_KERBEROS_APREQ_SECURITY_CONTEXT_POLICY_DESCRIPTION

Requirements

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